Skip to content

Commit

Permalink
feat(IntegrationDatasetLocks): add persistentId to User model
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Nov 6, 2023
1 parent 44dccbd commit 5e9b75e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/users/domain/models/User.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export interface User {
name: string
persistentId: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export class UserJSDataverseRepository implements UserRepository {
return getCurrentAuthenticatedUser
.execute()
.then((authenticatedUser: AuthenticatedUser) => {
return { name: authenticatedUser.displayName }
return {
name: authenticatedUser.displayName,
persistentId: authenticatedUser.persistentUserId
}
})
.catch((error: ReadError) => {
throw new Error(error.message)
Expand Down
3 changes: 2 additions & 1 deletion tests/component/users/domain/models/UserMother.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { User } from '../../../../../src/users/domain/models/User'
export class UserMother {
static create(): User {
return {
name: 'James D. Potts'
name: 'James D. Potts',
persistentId: 'jamesPotts'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('User JSDataverse Repository', () => {
beforeEach(() => TestsUtils.login())

it('gets the authenticated user', async () => {
const expectedUser = { name: 'Dataverse Admin' }
const expectedUser = { name: 'Dataverse Admin', persistentId: 'dataverseAdmin' }
const user = await userRepository.getAuthenticated()

expect(user).to.deep.equal(expectedUser)
Expand Down

0 comments on commit 5e9b75e

Please sign in to comment.