#5878 - FiscalData validations #1851

Merged
carlossa merged 58 commits from 5858-fiscalData-validations into dev 2024-02-28 13:53:34 +00:00
1 changed files with 47 additions and 0 deletions
Showing only changes of commit d864dfd899 - Show all commits

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();
}
});
});
});