fixed address

This commit is contained in:
Joan Sanchez 2019-02-28 10:17:09 +01:00
parent 4729dda5f6
commit d336fd0eb1
2 changed files with 6 additions and 24 deletions

View File

@ -18,7 +18,9 @@ describe('Client Create', () => {
email: 'Deadpool@marvel.com',
fi: '16195279J',
name: 'Wade',
socialName: 'Deadpool Marvel'
socialName: 'Deadpool Marvel',
street: 'Wall Street',
city: 'New York'
};
it(`should not find Deadpool as he's not created yet`, async() => {

View File

@ -3,14 +3,13 @@ const app = require('vn-loopback/server/server');
describe('loopback model address', () => {
let createdAddressId;
afterAll(async() => {
let address = await app.models.Address.findById(1);
afterAll(async done => {
let client = await app.models.Client.findById(101);
await address.updateAttribute('isDefaultAddress', true);
await app.models.Address.destroyById(createdAddressId);
await client.updateAttribute('isEqualizated', false);
done();
});
describe('observe()', () => {
@ -28,24 +27,6 @@ describe('loopback model address', () => {
expect(error).toBeDefined();
});
it('should set isDefaultAddress to false of all the addresses for a given client', async() => {
let previousDefaultAddress = await app.models.Address.findById(1);
expect(previousDefaultAddress.isDefaultAddress).toBeTruthy();
let address = await app.models.Address.findById(121);
expect(address.isDefaultAddress).toBeFalsy();
let defaultAddress = await address.updateAttribute('isDefaultAddress', true);
expect(defaultAddress.isDefaultAddress).toBeTruthy();
let noLongerDefaultAddress = await app.models.Address.findById(1);
expect(noLongerDefaultAddress.isDefaultAddress).toBeFalsy();
});
it('should set isEqualizated to true of a given Client to trigger any new address to have it', async() => {
let client = await app.models.Client.findById(101);
@ -58,7 +39,6 @@ describe('loopback model address', () => {
agencyModeFk: 5,
city: 'here',
isActive: true,
isDefaultAddress: false,
mobile: '555555555',
nickname: 'Test address',
phone: '555555555',