1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-16 00:20:06 +00:00

chore: fixed test err handling

This commit is contained in:
2022-05-16 15:42:12 +02:00
parent 1ac88ae102
commit 843cee4dbe
3 changed files with 8 additions and 8 deletions

View File

@@ -2604,7 +2604,7 @@
"node_modules/@sasjs/adapter": { "node_modules/@sasjs/adapter": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "file:../build/sasjs-adapter-5.0.0.tgz", "resolved": "file:../build/sasjs-adapter-5.0.0.tgz",
"integrity": "sha512-ARa1FFOHFdiVI/oHngmd5AJv6OZxeCwcHkpYEdrpY5syCg3hvTBYvmUZmxN4cRzwSsxAdiO9NGrHMgHbn5fV0Q==", "integrity": "sha512-mgXmDKqaKLieVaoICBCLwpI8pj4vff6yqOYySe+dX8+YD90yj2UM1AwDfxGakr9NcE2ptIgwYYAi823s4wNAxQ==",
"hasInstallScript": true, "hasInstallScript": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
@@ -23331,7 +23331,7 @@
}, },
"@sasjs/adapter": { "@sasjs/adapter": {
"version": "file:../build/sasjs-adapter-5.0.0.tgz", "version": "file:../build/sasjs-adapter-5.0.0.tgz",
"integrity": "sha512-ARa1FFOHFdiVI/oHngmd5AJv6OZxeCwcHkpYEdrpY5syCg3hvTBYvmUZmxN4cRzwSsxAdiO9NGrHMgHbn5fV0Q==", "integrity": "sha512-mgXmDKqaKLieVaoICBCLwpI8pj4vff6yqOYySe+dX8+YD90yj2UM1AwDfxGakr9NcE2ptIgwYYAi823s4wNAxQ==",
"requires": { "requires": {
"@sasjs/utils": "2.44.0", "@sasjs/utils": "2.44.0",
"axios": "0.26.0", "axios": "0.26.0",

View File

@@ -11,7 +11,7 @@ const Login = (): ReactElement<{}> => {
const handleSubmit = useCallback( const handleSubmit = useCallback(
(e) => { (e) => {
e.preventDefault() e.preventDefault()
appContext.adapter.logIn(username, password, 'clientID1').then((res) => { appContext.adapter.logIn(username, password).then((res) => {
appContext.setIsLoggedIn(res.isLoggedIn) appContext.setIsLoggedIn(res.isLoggedIn)
}) })
}, },

View File

@@ -37,7 +37,7 @@ export const basicTests = (
title: 'Log in', title: 'Log in',
description: 'Should log the user in', description: 'Should log the user in',
test: async () => { test: async () => {
return adapter.logIn(userName, password, 'clientID1') return adapter.logIn(userName, password)
}, },
assertion: (response: any) => assertion: (response: any) =>
response && response.isLoggedIn && response.userName === userName response && response.isLoggedIn && response.userName === userName
@@ -46,7 +46,7 @@ export const basicTests = (
title: 'Fetch username for already logged in user', title: 'Fetch username for already logged in user',
description: 'Should log the user in', description: 'Should log the user in',
test: async () => { test: async () => {
await adapter.logIn(userName, password, 'clientID1') await adapter.logIn(userName, password)
const newAdapterIns = new SASjs(adapter.getSasjsConfig()) const newAdapterIns = new SASjs(adapter.getSasjsConfig())
@@ -61,8 +61,8 @@ export const basicTests = (
'Should fail on first attempt and should log the user in on second attempt', 'Should fail on first attempt and should log the user in on second attempt',
test: async () => { test: async () => {
await adapter.logOut() await adapter.logOut()
await adapter.logIn('invalid', 'invalid', 'clientID1') await adapter.logIn('invalid', 'invalid').catch((err: any) => {})
return await adapter.logIn(userName, password, 'clientID1') return await adapter.logIn(userName, password)
}, },
assertion: (response: any) => assertion: (response: any) =>
response && response.isLoggedIn && response.userName === userName response && response.isLoggedIn && response.userName === userName
@@ -79,7 +79,7 @@ export const basicTests = (
stringData, stringData,
undefined, undefined,
async () => { async () => {
await adapter.logIn(userName, password, 'clientID1') await adapter.logIn(userName, password)
} }
) )
}, },