refs #5878 test: init test

This commit is contained in:
Javier Segarra 2023-12-20 06:45:40 +01:00
parent 8d5e174a64
commit d864dfd899
1 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
const valueIsNot = require('../value-is-not');
fdescribe('Value is not', () => {
const i18n = require('i18n');
const userId = 9;
const ctx = {
req: {
accessToken: {userId: userId},
headers: {origin: 'http://localhost:5000'},
}
};
it('UpdateFiscalData endpoint', () => {
let messageError = 'Value is not number';
const tag = 'provinceFk';
try {
expect(valueIsNot.validation(messageError)).toBeTrue();
expect(valueIsNot.message(i18n, tag)).toEqual('El campo \'Provincia\' no es válido');
const data = {
method: 'POST',
originalUrl: 'updateFiscalData',
body: {
[tag]: null
}
};
const result = valueIsNot.handleError(data);
expect(result).toEqual(tag);
} catch (error) {
expect(error).toBeDefined();
}
});
describe('OsTicket', () => {
let messageError = 'Value is not number';
it('sendToSupport endpoint', () => {
try {
expect(valueIsNot.validation(messageError)).toBeTrue();
expect(valueIsNot.message(ctx, 'provinceFk')).toEqual('El campo "Provincia" no es válido');
} catch (error) {
expect(error).toBeDefined();
}
});
});
});