This commit is contained in:
parent
4c7f42acb5
commit
d3165fcdc7
|
@ -4,6 +4,7 @@ const LoopBackContext = require('loopback-context');
|
||||||
describe('client canBeInvoiced()', () => {
|
describe('client canBeInvoiced()', () => {
|
||||||
const userId = 19;
|
const userId = 19;
|
||||||
const clientId = 1101;
|
const clientId = 1101;
|
||||||
|
const companyId = 442;
|
||||||
const activeCtx = {
|
const activeCtx = {
|
||||||
accessToken: {userId: userId}
|
accessToken: {userId: userId}
|
||||||
};
|
};
|
||||||
|
@ -23,7 +24,7 @@ describe('client canBeInvoiced()', () => {
|
||||||
const client = await models.Client.findById(clientId, null, options);
|
const client = await models.Client.findById(clientId, null, options);
|
||||||
await client.updateAttribute('isTaxDataChecked', false, options);
|
await client.updateAttribute('isTaxDataChecked', false, options);
|
||||||
|
|
||||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, options);
|
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||||
|
|
||||||
expect(canBeInvoiced).toEqual(false);
|
expect(canBeInvoiced).toEqual(false);
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ describe('client canBeInvoiced()', () => {
|
||||||
const client = await models.Client.findById(clientId, null, options);
|
const client = await models.Client.findById(clientId, null, options);
|
||||||
await client.updateAttribute('hasToInvoice', false, options);
|
await client.updateAttribute('hasToInvoice', false, options);
|
||||||
|
|
||||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, options);
|
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||||
|
|
||||||
expect(canBeInvoiced).toEqual(false);
|
expect(canBeInvoiced).toEqual(false);
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ describe('client canBeInvoiced()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, options);
|
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||||
|
|
||||||
expect(canBeInvoiced).toEqual(true);
|
expect(canBeInvoiced).toEqual(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue