This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Remove delete user feature from UI and handle study permissions …
…which have stale users (#595) * fix: Remove delete user feature from UI and handle study permissions which have stale users * chore: (PR feedback) deleted the commented line
- Loading branch information
Showing
9 changed files
with
159 additions
and
34 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
35 changes: 35 additions & 0 deletions
35
...e-raas-ui/packages/base-raas-ui/src/parts/studies/__tests__/StudyPermissionsTable.test.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,35 @@ | ||
import { getStaleUsers } from '../StudyPermissionsTable'; | ||
|
||
describe('StudyPermissionsTable tests', () => { | ||
describe('getStaleUsers', () => { | ||
it('Test stale users when no users are stale', async () => { | ||
const usersStore = {}; | ||
usersStore.asUserObjects = jest.fn().mockImplementationOnce(() => { | ||
return [{ id: 1 }, { id: 2 }]; | ||
}); | ||
const staleUsers = getStaleUsers([1, 2], usersStore); | ||
expect(staleUsers).toEqual([]); | ||
expect(usersStore.asUserObjects).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('Test stale users when all users are stale', async () => { | ||
const usersStore = {}; | ||
usersStore.asUserObjects = jest.fn().mockImplementationOnce(() => { | ||
return []; | ||
}); | ||
const staleUsers = getStaleUsers([1, 2], usersStore); | ||
expect(staleUsers).toEqual([1, 2]); | ||
expect(usersStore.asUserObjects).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('Test stale users when one user is stale', async () => { | ||
const usersStore = {}; | ||
usersStore.asUserObjects = jest.fn().mockImplementationOnce(() => { | ||
return [{ id: 1 }, { id: 4 }, { id: 3 }]; | ||
}); | ||
const staleUsers = getStaleUsers([1, 2, 4, 3], usersStore); | ||
expect(staleUsers).toEqual([2]); | ||
expect(usersStore.asUserObjects).toHaveBeenCalledTimes(1); | ||
}); | ||
}); | ||
}); |
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
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