mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-17 17:10:05 +00:00
chore: specs fixing, regex improve
This commit is contained in:
@@ -217,7 +217,7 @@ export class AuthManager {
|
|||||||
|
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
userName: userName.toLowerCase(),
|
userName: userName,
|
||||||
loginForm
|
loginForm
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -596,7 +596,6 @@ describe('AuthManager', () => {
|
|||||||
|
|
||||||
it('return session information when logged in - SAS9 - having full name in html', async () => {
|
it('return session information when logged in - SAS9 - having full name in html', async () => {
|
||||||
const fullname = 'FirstName LastName'
|
const fullname = 'FirstName LastName'
|
||||||
const username = 'firlas'
|
|
||||||
const serverType = ServerType.Sas9
|
const serverType = ServerType.Sas9
|
||||||
const authManager = new AuthManager(
|
const authManager = new AuthManager(
|
||||||
serverUrl,
|
serverUrl,
|
||||||
@@ -612,7 +611,7 @@ describe('AuthManager', () => {
|
|||||||
|
|
||||||
const response = await authManager.checkSession()
|
const response = await authManager.checkSession()
|
||||||
expect(response.isLoggedIn).toBeTruthy()
|
expect(response.isLoggedIn).toBeTruthy()
|
||||||
expect(response.userName).toEqual(username)
|
expect(response.userName).toEqual(fullname)
|
||||||
expect(mockedAxios.get).toHaveBeenNthCalledWith(
|
expect(mockedAxios.get).toHaveBeenNthCalledWith(
|
||||||
1,
|
1,
|
||||||
`http://test-server.com/SASStoredProcess`,
|
`http://test-server.com/SASStoredProcess`,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const dictionary = ['Log Off']
|
|||||||
* @returns username
|
* @returns username
|
||||||
*/
|
*/
|
||||||
export const extractUserNameSas9 = (response: string) => {
|
export const extractUserNameSas9 = (response: string) => {
|
||||||
const regex = /"title":\s?".*"/
|
const regex = /"title":\s?".*?"/
|
||||||
|
|
||||||
const matched = response?.match(regex)
|
const matched = response?.match(regex)
|
||||||
let username = matched?.[0].split(':')[1].trim()
|
let username = matched?.[0].split(':')[1].trim()
|
||||||
|
|||||||
Reference in New Issue
Block a user