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 provinceId = 5;
|
||||||
const incotermsId = 'FAS';
|
const incotermsId = 'FAS';
|
||||||
const customAgentOneId = 1;
|
const customAgentOneId = 1;
|
||||||
|
const ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: 1}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
it('should throw the non uee member error if no incoterms is defined', async() => {
|
it('should throw the non uee member error if no incoterms is defined', async() => {
|
||||||
const tx = await models.Client.beginTransaction({});
|
const tx = await models.Client.beginTransaction({});
|
||||||
|
@ -14,14 +19,9 @@ describe('Address updateAddress', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ctx = {
|
ctx.args = {
|
||||||
req: {
|
provinceFk: provinceId,
|
||||||
accessToken: {userId: 1}
|
customsAgentFk: customAgentOneId
|
||||||
},
|
|
||||||
args: {
|
|
||||||
provinceFk: provinceId,
|
|
||||||
customsAgentFk: customAgentOneId
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||||
|
@ -43,14 +43,9 @@ describe('Address updateAddress', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ctx = {
|
ctx.args = {
|
||||||
req: {
|
provinceFk: provinceId,
|
||||||
accessToken: {userId: 1}
|
incotermsFk: incotermsId
|
||||||
},
|
|
||||||
args: {
|
|
||||||
provinceFk: provinceId,
|
|
||||||
incotermsFk: incotermsId
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||||
|
@ -72,16 +67,11 @@ describe('Address updateAddress', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const expectedResult = 'My edited address';
|
const expectedResult = 'My edited address';
|
||||||
const ctx = {
|
ctx.args = {
|
||||||
req: {
|
provinceFk: provinceId,
|
||||||
accessToken: {userId: 1}
|
nickname: expectedResult,
|
||||||
},
|
incotermsFk: incotermsId,
|
||||||
args: {
|
customsAgentFk: customAgentOneId
|
||||||
provinceFk: provinceId,
|
|
||||||
nickname: expectedResult,
|
|
||||||
incotermsFk: incotermsId,
|
|
||||||
customsAgentFk: customAgentOneId
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||||
|
@ -102,13 +92,8 @@ describe('Address updateAddress', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ctx = {
|
ctx.args = {
|
||||||
req: {
|
isLogifloraAllowed: true
|
||||||
accessToken: {userId: 1}
|
|
||||||
},
|
|
||||||
args: {
|
|
||||||
isLogifloraAllowed: true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||||
|
@ -126,13 +111,9 @@ describe('Address updateAddress', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ctx = {
|
ctx.req.accessToken.userId = 21;
|
||||||
req: {
|
ctx.args = {
|
||||||
accessToken: {userId: 21}
|
isLogifloraAllowed: true
|
||||||
},
|
|
||||||
args: {
|
|
||||||
isLogifloraAllowed: true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||||
|
@ -154,13 +135,8 @@ describe('Address updateAddress', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const expectedResult = 'My second time edited address';
|
const expectedResult = 'My second time edited address';
|
||||||
const ctx = {
|
ctx.args = {
|
||||||
req: {
|
nickname: expectedResult
|
||||||
accessToken: {userId: 1}
|
|
||||||
},
|
|
||||||
args: {
|
|
||||||
nickname: expectedResult
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
await models.Client.updateAddress(ctx, clientId, addressId, options);
|
||||||
|
|
Loading…
Reference in New Issue