-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add storybook and fix the factory repo
- Loading branch information
1 parent
5a8146e
commit 5612bcb
Showing
9 changed files
with
157 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/sections/account/api-token-section/CreateUserRepositoryFactory.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { UserJSDataverseRepository } from '@/users/infrastructure/repositories/UserJSDataverseRepository' | ||
import { TokenInfo } from '@/users/domain/models/TokenInfo' | ||
import { User } from '@/users/domain/models/User' | ||
import { FakerHelper } from '@tests/component/shared/FakerHelper' | ||
|
||
export class AccountPageMockErrorUserRepository extends UserJSDataverseRepository { | ||
getAuthenticated(): Promise<User> { | ||
return new Promise((_resolve, reject) => { | ||
setTimeout(() => { | ||
reject('Something went wrong getting authentication. Try again later.') | ||
}, FakerHelper.loadingTimout()) | ||
}) | ||
} | ||
|
||
removeAuthenticated(): Promise<void> { | ||
return new Promise((_resolve, reject) => { | ||
setTimeout(() => { | ||
reject('Something went wrong removing authentication. Try again later.') | ||
}, FakerHelper.loadingTimout()) | ||
}) | ||
} | ||
|
||
getCurrentApiToken(): Promise<TokenInfo> { | ||
return new Promise((_resolve, reject) => { | ||
setTimeout(() => { | ||
reject('Something went wrong getting the current api token. Try again later.') | ||
}, FakerHelper.loadingTimout()) | ||
}) | ||
} | ||
|
||
recreateApiToken(): Promise<TokenInfo> { | ||
return new Promise((_resolve, reject) => { | ||
setTimeout(() => { | ||
reject('Something went wrong creating the api token. Try again later.') | ||
}, FakerHelper.loadingTimout()) | ||
}) | ||
} | ||
|
||
deleteApiToken(): Promise<void> { | ||
return new Promise((_resolve, reject) => { | ||
setTimeout(() => { | ||
reject('Something went wrong revoking the api token. Try again later.') | ||
}, FakerHelper.loadingTimout()) | ||
}) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/stories/account/AccountPageMockLoadingUserRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { UserJSDataverseRepository } from '@/users/infrastructure/repositories/UserJSDataverseRepository' | ||
import { TokenInfo } from '@/users/domain/models/TokenInfo' | ||
import { User } from '@/users/domain/models/User' | ||
|
||
export class AccountPageMockLoadingUserRepository extends UserJSDataverseRepository { | ||
getAuthenticated(): Promise<User> { | ||
return new Promise(() => {}) | ||
} | ||
|
||
removeAuthenticated(): Promise<void> { | ||
return new Promise(() => {}) | ||
} | ||
|
||
getCurrentApiToken(): Promise<TokenInfo> { | ||
return new Promise(() => {}) | ||
} | ||
|
||
recreateApiToken(): Promise<TokenInfo> { | ||
return new Promise(() => {}) | ||
} | ||
|
||
deleteApiToken(): Promise<void> { | ||
return new Promise(() => {}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { UserJSDataverseRepository } from '@/users/infrastructure/repositories/UserJSDataverseRepository' | ||
import { TokenInfo } from '@/users/domain/models/TokenInfo' | ||
import { User } from '@/users/domain/models/User' | ||
|
||
export class AccountPageMockUserRepository extends UserJSDataverseRepository { | ||
getAuthenticated(): Promise<User> { | ||
return Promise.resolve({ | ||
displayName: 'mockDisplayName', | ||
persistentId: 'mockPersistentId', | ||
firstName: 'mockFirstName', | ||
lastName: 'mockLastName', | ||
email: 'mockEmail', | ||
affiliation: 'mockAffiliation', | ||
superuser: true | ||
}) | ||
} | ||
|
||
removeAuthenticated(): Promise<void> { | ||
return Promise.resolve() | ||
} | ||
|
||
getCurrentApiToken(): Promise<TokenInfo> { | ||
return Promise.resolve({ | ||
apiToken: 'mock api token', | ||
expirationDate: new Date() | ||
}) | ||
} | ||
|
||
recreateApiToken(): Promise<TokenInfo> { | ||
return Promise.resolve({ | ||
apiToken: 'updated mock api token', | ||
expirationDate: new Date() | ||
}) | ||
} | ||
|
||
deleteApiToken(): Promise<void> { | ||
return Promise.resolve() | ||
} | ||
} |