@@ -6,24 +6,27 @@ import {
66import { TestConstants } from '../../testHelpers/TestConstants'
77import { ReadError } from '../../../src'
88
9- describe ( 'getCurrentAuthenticatedUser ' , ( ) => {
9+ describe ( 'UsersRepository ' , ( ) => {
1010 const sut : UsersRepository = new UsersRepository ( )
1111
12- test ( 'should return error when authentication is not valid' , async ( ) => {
13- ApiConfig . init ( TestConstants . TEST_API_URL , DataverseApiAuthMechanism . API_KEY , 'invalidApiKey' )
12+ describe ( 'getCurrentAuthenticatedUser' , ( ) => {
13+ test ( 'should return error when authentication is not valid' , async ( ) => {
14+ ApiConfig . init ( TestConstants . TEST_API_URL , DataverseApiAuthMechanism . API_KEY , 'invalidApiKey' )
1415
15- const errorExpected : ReadError = new ReadError ( '[401] Bad API key' )
16- await expect ( sut . getCurrentAuthenticatedUser ( ) ) . rejects . toThrow ( errorExpected )
17- } )
18-
19- test ( 'should return authenticated user when valid authentication is provided' , async ( ) => {
20- ApiConfig . init (
21- TestConstants . TEST_API_URL ,
22- DataverseApiAuthMechanism . API_KEY ,
23- process . env . TEST_API_KEY
24- )
16+ const errorExpected : ReadError = new ReadError ( '[401] Bad API key' )
17+ await expect ( sut . getCurrentAuthenticatedUser ( ) ) . rejects . toThrow ( errorExpected )
18+ } )
2519
26- const actual = await sut . getCurrentAuthenticatedUser ( )
27- expect ( actual . firstName ) . toBe ( 'Dataverse' )
20+ test ( 'should return authenticated user when valid authentication is provided' , async ( ) => {
21+ ApiConfig . init (
22+ TestConstants . TEST_API_URL ,
23+ DataverseApiAuthMechanism . API_KEY ,
24+ process . env . TEST_API_KEY
25+ )
26+ const actual = await sut . getCurrentAuthenticatedUser ( )
27+ expect ( actual . firstName ) . toBe ( 'Dataverse' )
28+ } )
2829 } )
30+
31+ describe ( 'recreateApiToken' , ( ) => { } )
2932} )
0 commit comments