1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

fix: master tests fixed

This commit is contained in:
Saad Jutt
2021-05-06 22:28:06 +05:00
parent 665734b168
commit 80e5de5d65
4 changed files with 104 additions and 27 deletions

View File

@@ -2005,18 +2005,18 @@
}, },
"@sasjs/adapter": { "@sasjs/adapter": {
"version": "file:../build/sasjs-adapter-5.0.0.tgz", "version": "file:../build/sasjs-adapter-5.0.0.tgz",
"integrity": "sha512-1t+3LIL2BFw8HpZUPI9QM24801+JH4DCAu4eHoLLmytYhN72asMi1aVtgSDb1xiJYgpbTG7EK3qRpHIV8cEN8w==", "integrity": "sha512-M7R1F4gBHZRjDD/lI3v3v9jnX7Lvhp3W1xD/0imKaLt7LZfth1VSLf4umwwajmlRUlktJ4ht6dugXqZLOh+4wQ==",
"requires": { "requires": {
"@sasjs/utils": "^2.5.0", "@sasjs/utils": "^2.10.2",
"axios": "^0.21.1", "axios": "^0.21.1",
"form-data": "^3.0.0", "form-data": "^4.0.0",
"https": "^1.0.0" "https": "^1.0.0"
}, },
"dependencies": { "dependencies": {
"form-data": { "form-data": {
"version": "3.0.1", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": { "requires": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "^1.0.8", "combined-stream": "^1.0.8",
@@ -2046,14 +2046,70 @@
} }
}, },
"@sasjs/utils": { "@sasjs/utils": {
"version": "2.5.1", "version": "2.12.1",
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.5.1.tgz", "resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.12.1.tgz",
"integrity": "sha512-a3ISiUX8Yz7au4XYxq2KWf9ODT6nsIDbE4FEqS+AQ3McxZkfuAk4v+REXjOmIlcyQd4R4bufEK8XoB6AROn9sA==", "integrity": "sha512-6gZS5zW0J70P7XaVuEczyfHVaVa8Ks/aWr4PIlpJcxWD0enJtCEmos2DdnezdSoNvODkPq/8rzMPqko5jaXK1Q==",
"requires": { "requires": {
"@types/prompts": "^2.0.9", "@types/prompts": "^2.0.11",
"chalk": "^4.1.1",
"cli-table": "^0.3.6",
"consola": "^2.15.0", "consola": "^2.15.0",
"prompts": "^2.4.0", "prompts": "^2.4.1",
"valid-url": "^1.0.9" "valid-url": "^1.0.9"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
},
"prompts": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.1.tgz",
"integrity": "sha512-EQyfIuO2hPDsX1L/blblV+H7I0knhgAd82cVneCwcdND9B8AuCDuRcBH6yIcG4dFzlOUqbazQqwGjx5xmsNLuQ==",
"requires": {
"kleur": "^3.0.3",
"sisteransi": "^1.0.5"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"requires": {
"has-flag": "^4.0.0"
}
}
} }
}, },
"@semantic-ui-react/event-stack": { "@semantic-ui-react/event-stack": {
@@ -2366,9 +2422,9 @@
"integrity": "sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA==" "integrity": "sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA=="
}, },
"@types/prompts": { "@types/prompts": {
"version": "2.0.9", "version": "2.0.11",
"resolved": "https://registry.npmjs.org/@types/prompts/-/prompts-2.0.9.tgz", "resolved": "https://registry.npmjs.org/@types/prompts/-/prompts-2.0.11.tgz",
"integrity": "sha512-TORZP+FSjTYMWwKadftmqEn6bziN5RnfygehByGsjxoK5ydnClddtv6GikGWPvCm24oI+YBwck5WDxIIyNxUrA==", "integrity": "sha512-dcF5L3rU9VfpLEJIV++FEyhGhuIpJllNEwllVuJ5g8eoVqjf048tW9+spivIwjzgPbtaGAl7mIZW3cmhDAq2UQ==",
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
} }
@@ -4460,6 +4516,14 @@
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
"integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="
}, },
"cli-table": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.6.tgz",
"integrity": "sha512-ZkNZbnZjKERTY5NwC2SeMeLeifSPq/pubeRoTpdr3WchLlnZg6hEgvHkK5zL7KNFdd9PmHN8lxrENUwI3cE8vQ==",
"requires": {
"colors": "1.0.3"
}
},
"cliui": { "cliui": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
@@ -4568,6 +4632,11 @@
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz",
"integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==" "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw=="
}, },
"colors": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs="
},
"combined-stream": { "combined-stream": {
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",

View File

@@ -4,7 +4,7 @@
"homepage": ".", "homepage": ".",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@sasjs/adapter": "^2.2.4", "@sasjs/adapter": "file:../build/sasjs-adapter-5.0.0.tgz",
"@sasjs/test-framework": "^1.4.0", "@sasjs/test-framework": "^1.4.0",
"@types/jest": "^26.0.20", "@types/jest": "^26.0.20",
"@types/node": "^14.14.25", "@types/node": "^14.14.25",
@@ -23,8 +23,8 @@
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"update:adapter": "cd .. && npm run package:lib && cd sasjs-tests && npm i ../build/sasjs-adapter-5.0.0.tgz", "update:adapter": "cd .. && npm run package:lib && cd sasjs-tests && npm i ../build/sasjs-adapter-5.0.0.tgz",
"deploy:tests": "npm run build && rsync -avhe ssh ./build/* --delete $SSH_ACCOUNT:$DEPLOY_PATH", "deploy:tests": "rsync -avhe ssh ./build/* --delete $SSH_ACCOUNT:$DEPLOY_PATH",
"deploy": "npm run update:adapter && npm run deploy:tests" "deploy": "npm run update:adapter && npm run build && npm run deploy:tests"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"

View File

@@ -59,10 +59,15 @@ export const basicTests = (
"Should trigger required login callback and after successful login, it should finish the request", "Should trigger required login callback and after successful login, it should finish the request",
test: async () => { test: async () => {
await adapter.logOut(); await adapter.logOut();
return await adapter.request("common/sendArr", stringData, null, () => { return await adapter.request(
adapter.logIn(userName, password); "common/sendArr",
}); stringData,
undefined,
() => {
adapter.logIn(userName, password);
}
);
}, },
assertion: (response: any) => { assertion: (response: any) => {
return response.table1[0][0] === stringData.table1[0].col1; return response.table1[0][0] === stringData.table1[0].col1;
@@ -75,9 +80,9 @@ export const basicTests = (
test: async () => { test: async () => {
const config = { const config = {
debug: true debug: true
} };
return await adapter.request("common/sendArr", stringData, config) return await adapter.request("common/sendArr", stringData, config);
}, },
assertion: (response: any) => { assertion: (response: any) => {
return response.table1[0][0] === stringData.table1[0].col1; return response.table1[0][0] === stringData.table1[0].col1;

View File

@@ -15,6 +15,7 @@ const multipleRowsWithNulls: any = {
{ col1: 42, col2: 1.62, col3: "x", col4: "x" } { col1: 42, col2: 1.62, col3: "x", col4: "x" }
] ]
}; };
const multipleColumnsWithNulls: any = { const multipleColumnsWithNulls: any = {
table1: [ table1: [
{ col1: 42, col2: null, col3: "x", col4: null }, { col1: 42, col2: null, col3: "x", col4: null },
@@ -136,7 +137,8 @@ export const sendArrTests = (adapter: SASjs): TestSuite => ({
res.table1[index][2] === multipleRowsWithNulls.table1[index].col3; res.table1[index][2] === multipleRowsWithNulls.table1[index].col3;
result = result =
result && result &&
res.table1[index][3] === multipleRowsWithNulls.table1[index].col4; res.table1[index][3] ===
(multipleRowsWithNulls.table1[index].col4 || " ");
}); });
return result; return result;
} }
@@ -165,7 +167,7 @@ export const sendArrTests = (adapter: SASjs): TestSuite => ({
result = result =
result && result &&
res.table1[index][3] === res.table1[index][3] ===
(multipleColumnsWithNulls.table1[index].col4 || ""); (multipleColumnsWithNulls.table1[index].col4 || " ");
}); });
return result; return result;
} }
@@ -280,7 +282,8 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
res.table1[index].COL3 === multipleRowsWithNulls.table1[index].col3; res.table1[index].COL3 === multipleRowsWithNulls.table1[index].col3;
result = result =
result && result &&
res.table1[index].COL4 === multipleRowsWithNulls.table1[index].col4; res.table1[index].COL4 ===
(multipleRowsWithNulls.table1[index].col4 || " ");
}); });
return result; return result;
} }
@@ -309,7 +312,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
result = result =
result && result &&
res.table1[index].COL4 === res.table1[index].COL4 ===
(multipleColumnsWithNulls.table1[index].col4 || ""); (multipleColumnsWithNulls.table1[index].col4 || " ");
}); });
return result; return result;
} }