1
0
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:
2022-09-22 16:26:45 +02:00
parent 5259cf3942
commit 61fdf5573b
3 changed files with 3 additions and 4 deletions

View File

@@ -217,7 +217,7 @@ export class AuthManager {
return Promise.resolve({
isLoggedIn,
userName: userName.toLowerCase(),
userName: userName,
loginForm
})
}

View File

@@ -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`,

View File

@@ -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()