fixed address
This commit is contained in:
parent
4729dda5f6
commit
d336fd0eb1
|
@ -18,7 +18,9 @@ describe('Client Create', () => {
|
||||||
email: 'Deadpool@marvel.com',
|
email: 'Deadpool@marvel.com',
|
||||||
fi: '16195279J',
|
fi: '16195279J',
|
||||||
name: 'Wade',
|
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() => {
|
it(`should not find Deadpool as he's not created yet`, async() => {
|
||||||
|
|
|
@ -3,14 +3,13 @@ const app = require('vn-loopback/server/server');
|
||||||
describe('loopback model address', () => {
|
describe('loopback model address', () => {
|
||||||
let createdAddressId;
|
let createdAddressId;
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async done => {
|
||||||
let address = await app.models.Address.findById(1);
|
|
||||||
let client = await app.models.Client.findById(101);
|
let client = await app.models.Client.findById(101);
|
||||||
|
|
||||||
await address.updateAttribute('isDefaultAddress', true);
|
|
||||||
await app.models.Address.destroyById(createdAddressId);
|
await app.models.Address.destroyById(createdAddressId);
|
||||||
|
|
||||||
await client.updateAttribute('isEqualizated', false);
|
await client.updateAttribute('isEqualizated', false);
|
||||||
|
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('observe()', () => {
|
describe('observe()', () => {
|
||||||
|
@ -28,24 +27,6 @@ describe('loopback model address', () => {
|
||||||
expect(error).toBeDefined();
|
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() => {
|
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);
|
let client = await app.models.Client.findById(101);
|
||||||
|
|
||||||
|
@ -58,7 +39,6 @@ describe('loopback model address', () => {
|
||||||
agencyModeFk: 5,
|
agencyModeFk: 5,
|
||||||
city: 'here',
|
city: 'here',
|
||||||
isActive: true,
|
isActive: true,
|
||||||
isDefaultAddress: false,
|
|
||||||
mobile: '555555555',
|
mobile: '555555555',
|
||||||
nickname: 'Test address',
|
nickname: 'Test address',
|
||||||
phone: '555555555',
|
phone: '555555555',
|
||||||
|
|
Loading…
Reference in New Issue