Skip to content

Commit

Permalink
Fixes Unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Mar 28, 2024
1 parent 00989ba commit b706840
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ interface PermissionEditModalDeps {
groupName: string;
action: Action;
allowedActions: string[];
dataSourceId: string;
optionUniverse: ComboBoxOptions;
handleClose: () => void;
handleSave: (groupName: string, allowedActions: string[]) => Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ export function PermissionList(props: AppDependencies) {
groupName={initialGroupName}
action={action}
allowedActions={initialAllowedAction}
dataSourceId={dataSource.id}
optionUniverse={permissionList.map((group) => stringToComboBoxOption(group.name))}
handleClose={() => setEditModal(null)}
handleSave={async (groupName, allowedAction) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ jest.mock('../../../utils/toast-utils', () => ({
useToastState: jest.fn().mockReturnValue([[], jest.fn(), jest.fn()]),
}));

jest.mock('react', () => ({
...jest.requireActual('react'),
useContext: jest.fn().mockReturnValue({ dataSource: { id: 'test' }, setDataSource: jest.fn() }), // Mock the useContext hook to return dummy datasource and setdatasource function
}));

describe('Permission list page ', () => {
const sampleActionGroup: PermissionListingItem = {
name: 'group',
Expand Down

0 comments on commit b706840

Please sign in to comment.