refactor(client_updateAddress): refactor ctx variable
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
afc03fc60e
commit
bcbe264f0a
|
@ -6,6 +6,11 @@ describe('Address updateAddress', () => {
|
|||
const provinceId = 5;
|
||||
const incotermsId = 'FAS';
|
||||
const customAgentOneId = 1;
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: 1}
|
||||
}
|
||||
};
|
||||
|
||||
it('should throw the non uee member error if no incoterms is defined', async() => {
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
@ -14,14 +19,9 @@ describe('Address updateAddress', () => {
|
|||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: 1}
|
||||
},
|
||||
args: {
|
||||
provinceFk: provinceId,
|
||||
customsAgentFk: customAgentOneId
|
||||
}
|
||||
ctx.args = {
|
||||
provinceFk: provinceId,
|
||||
customsAgentFk: customAgentOneId
|
||||
};
|
||||
|
||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||
|
@ -43,14 +43,9 @@ describe('Address updateAddress', () => {
|
|||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: 1}
|
||||
},
|
||||
args: {
|
||||
provinceFk: provinceId,
|
||||
incotermsFk: incotermsId
|
||||
}
|
||||
ctx.args = {
|
||||
provinceFk: provinceId,
|
||||
incotermsFk: incotermsId
|
||||
};
|
||||
|
||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||
|
@ -72,16 +67,11 @@ describe('Address updateAddress', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
const expectedResult = 'My edited address';
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: 1}
|
||||
},
|
||||
args: {
|
||||
provinceFk: provinceId,
|
||||
nickname: expectedResult,
|
||||
incotermsFk: incotermsId,
|
||||
customsAgentFk: customAgentOneId
|
||||
}
|
||||
ctx.args = {
|
||||
provinceFk: provinceId,
|
||||
nickname: expectedResult,
|
||||
incotermsFk: incotermsId,
|
||||
customsAgentFk: customAgentOneId
|
||||
};
|
||||
|
||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||
|
@ -102,13 +92,8 @@ describe('Address updateAddress', () => {
|
|||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: 1}
|
||||
},
|
||||
args: {
|
||||
isLogifloraAllowed: true
|
||||
}
|
||||
ctx.args = {
|
||||
isLogifloraAllowed: true
|
||||
};
|
||||
|
||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||
|
@ -126,13 +111,9 @@ describe('Address updateAddress', () => {
|
|||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: 21}
|
||||
},
|
||||
args: {
|
||||
isLogifloraAllowed: true
|
||||
}
|
||||
ctx.req.accessToken.userId = 21;
|
||||
ctx.args = {
|
||||
isLogifloraAllowed: true
|
||||
};
|
||||
|
||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||
|
@ -154,13 +135,8 @@ describe('Address updateAddress', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
const expectedResult = 'My second time edited address';
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: 1}
|
||||
},
|
||||
args: {
|
||||
nickname: expectedResult
|
||||
}
|
||||
ctx.args = {
|
||||
nickname: expectedResult
|
||||
};
|
||||
|
||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||
|
|
Loading…
Reference in New Issue