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