delete test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
061dceb2b0
commit
f9025bef98
|
@ -222,18 +222,13 @@ module.exports = Self => {
|
|||
|
||||
app.on('started', function() {
|
||||
let account = app.models.Account;
|
||||
|
||||
account.observe('before save', async ctx => {
|
||||
if (ctx.isNewInstance) return;
|
||||
ctx.hookState.oldInstance = JSON.parse(JSON.stringify(ctx.currentInstance));
|
||||
});
|
||||
|
||||
account.observe('after save', async ctx => {
|
||||
console.log('--------------asdajdgsaysdgahsdkasgdagdsjhagdkadasda--------------');
|
||||
console.log('--------------asdajdgsaysdgahsdkasgdagdsjhagdkadasda--------------');
|
||||
console.log('--------------asdajdgsaysdgahsdkasgdagdsjhagdkadasda--------------');
|
||||
console.log('--------------asdajdgsaysdgahsdkasgdagdsjhagdkadasda--------------');
|
||||
console.log('--------------asdajdgsaysdgahsdkasgdagdsjhagdkadasda--------------');
|
||||
console.log('--------------asdajdgsaysdgahsdkasgdagdsjhagdkadasda--------------');
|
||||
console.log('--------------asdajdgsaysdgahsdkasgdagdsjhagdkadasda--------------');
|
||||
let changes = ctx.data || ctx.instance;
|
||||
if (!ctx.isNewInstance && changes) {
|
||||
let oldData = ctx.hookState.oldInstance;
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
fdescribe('loopback model client', () => {
|
||||
const accountId = 101;
|
||||
let originalValue;
|
||||
afterAll(async done => {
|
||||
// await originalValue.save();
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
describe('observe()', () => {
|
||||
it('should log when we update the account model', async() => {
|
||||
originalValue = await app.models.Account.findById(accountId);
|
||||
let account = await app.models.Account.findById(accountId);
|
||||
|
||||
await account.updateAttribute('name', 'updatingName');
|
||||
let clientLog = await app.models.ClientLog.find({where: {originFk: accountId}});
|
||||
console.log('clientLog', clientLog);
|
||||
// let logs = await app.models.ClientLog.find({fields: ['id', 'newInstance']});
|
||||
|
||||
// let m3Log = logs.filter(log => {
|
||||
// return log.newInstance.m3 === 1.9;
|
||||
// });
|
||||
// logIdToDestroy = m3Log[0].id;
|
||||
|
||||
expect(clientLog).toBe();
|
||||
});
|
||||
|
||||
xit('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(clientId);
|
||||
|
||||
expect(client.isEqualizated).toBeFalsy();
|
||||
|
||||
await client.updateAttribute('isEqualizated', true);
|
||||
|
||||
let newAddress = await app.models.Address.create({
|
||||
clientFk: clientId,
|
||||
agencyModeFk: 5,
|
||||
city: 'here',
|
||||
isActive: true,
|
||||
mobile: '555555555',
|
||||
nickname: 'Test address',
|
||||
phone: '555555555',
|
||||
postalCode: '46000',
|
||||
provinceFk: 1,
|
||||
street: 'Test address',
|
||||
incotermsFk: 'FAS',
|
||||
customsAgentFk: 1
|
||||
});
|
||||
|
||||
expect(newAddress.isEqualizated).toBeTruthy();
|
||||
|
||||
createdAddressId = newAddress.id;
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue