-
-
Notifications
You must be signed in to change notification settings - Fork 864
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* implemented correct user roles * requested changes added * requested changes added-1 * requested changes added-2 * requested changes added-3
- Loading branch information
Showing
3 changed files
with
69 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import { Provider } from 'react-redux'; | |
import { store } from 'state/store'; | ||
import i18nForTest from 'utils/i18nForTest'; | ||
import { StaticMockLink } from 'utils/StaticMockLink'; | ||
import type { InterfaceMember } from './People'; | ||
// import type { InterfaceMember } from './People'; | ||
import People from './People'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { vi } from 'vitest'; | ||
|
@@ -168,62 +168,6 @@ describe('Testing People Screen [User Portal]', () => { | |
expect(screen.queryAllByText('Noble Mittal')).not.toBe([]); | ||
}); | ||
|
||
function compareProperties( | ||
expectedProps: string[], | ||
actualObject: object, | ||
): boolean { | ||
const actualProps = Object.keys(actualObject); | ||
return expectedProps.every((prop) => actualProps.includes(prop)); | ||
} | ||
|
||
describe('InterfaceMember properties comparison', () => { | ||
it('should have all required properties', () => { | ||
const expectedProperties = [ | ||
'firstName', | ||
'lastName', | ||
'image', | ||
'_id', | ||
'email', | ||
'__typename', | ||
]; | ||
|
||
const mockValidData: InterfaceMember = { | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
image: 'https://example.com/john.jpg', | ||
_id: '1', | ||
email: '[email protected]', | ||
__typename: 'User', | ||
}; | ||
|
||
const result = compareProperties(expectedProperties, mockValidData); | ||
expect(result).toBe(true); | ||
}); | ||
|
||
it('should fail if __typename is replaced with username', () => { | ||
const expectedProperties = [ | ||
'firstName', | ||
'lastName', | ||
'image', | ||
'_id', | ||
'email', | ||
'__typename', // Expect this property | ||
]; | ||
|
||
const mockInvalidData = { | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
image: 'https://example.com/john.jpg', | ||
_id: '1', | ||
email: '[email protected]', | ||
username: 'Member', // Incorrect property | ||
}; | ||
|
||
const result = compareProperties(expectedProperties, mockInvalidData); | ||
expect(result).toBe(false); | ||
}); | ||
}); | ||
|
||
it('Search works properly by pressing enter', async () => { | ||
render( | ||
<MockedProvider addTypename={false} link={link}> | ||
|
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