feat(client): add backTest
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-04-01 12:13:24 +02:00
parent d4136cde0b
commit 86b24ecd1d
2 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,24 @@
const models = require('vn-loopback/server/server').models;
describe('client checkDuplicated()', () => {
it('should send an mail if mobile/phone/email is duplicated', async() => {
const tx = await models.Client.beginTransaction({});
try {
const options = {transaction: tx};
const id = 1110;
const mailModel = models.Mail;
spyOn(mailModel, 'create');
await models.Client.checkDuplicatedData(id, options);
expect(mailModel.create).toHaveBeenCalled();
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -10,9 +10,10 @@ export default class Controller extends Section {
} }
onSubmit() { onSubmit() {
return this.$.watcher.submit() return this.$.watcher.submit().then(json => {
.then(json => this.$state.go('client.card.basicData', {id: json.data.id})) this.$state.go('client.card.basicData', {id: json.data.id});
.then(() => this.$http.get(`Clients/${this.client.id}/checkDuplicatedData`)); this.$http.get(`Clients/${this.client.id}/checkDuplicatedData`);
});
} }
get province() { get province() {