-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(invites): resource * feat(invites): +JsDoc on invites --------- Co-authored-by: Danny Gauthier <[email protected]> Co-authored-by: Felix <[email protected]>
- Loading branch information
1 parent
5899382
commit 478d2d7
Showing
6 changed files
with
67 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export interface AuthInviteModel { | ||
/** | ||
* Invite ID. | ||
*/ | ||
id: string; | ||
/** | ||
* Invite group name. | ||
*/ | ||
displayName: string; | ||
/** | ||
* Organizations array will always have only one item. | ||
*/ | ||
organizations: Array<{ | ||
/** | ||
* Org ID where the user is invited in a group. | ||
*/ | ||
id: string; | ||
/** | ||
* Org ID where the user is invited in a group. | ||
*/ | ||
displayName: string; | ||
}>; | ||
} |
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,12 @@ | ||
import Resource from '../Resource.js'; | ||
import {AuthInviteModel} from './Invites.model.js'; | ||
|
||
export default class Invites extends Resource { | ||
static baseUrl = '/rest/invites'; | ||
/** | ||
* Lists groups current user is invited too. | ||
*/ | ||
list() { | ||
return this.api.get<AuthInviteModel[]>(Invites.baseUrl); | ||
} | ||
} |
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,2 @@ | ||
export * from './Invites.model.js'; | ||
export * from './Invites.js'; |
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,26 @@ | ||
import API from '../../../APICore.js'; | ||
import Invites from '../Invites.js'; | ||
jest.mock('../../../APICore.js'); | ||
|
||
const APIMock: jest.Mock<API> = API as any; | ||
|
||
describe('Invites', () => { | ||
let invites: Invites; | ||
|
||
const api = new APIMock() as jest.Mocked<API>; | ||
const serverlessApi = new APIMock() as jest.Mocked<API>; | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
invites = new Invites(api, serverlessApi); | ||
}); | ||
|
||
describe('list', () => { | ||
it('should make a GET call with all parameters', () => { | ||
invites.list(); | ||
|
||
expect(api.get).toHaveBeenCalledTimes(1); | ||
expect(api.get).toHaveBeenCalledWith(Invites.baseUrl); | ||
}); | ||
}); | ||
}); |
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