-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add unit test and rename file
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
client/packages/components/src/components/presence-indicator/PresenceIndicator.tsx
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
26 changes: 26 additions & 0 deletions
26
...ackages/components/src/components/presence-indicator/utils/parse-presence-status.test.tsx
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 { it, describe, expect } from 'vitest'; | ||
import { getPresenceInfo } from './parse-presence-status'; | ||
import { Icon } from '@equinor/eds-core-react'; | ||
import { account_circle, help_outline } from '@equinor/eds-icons'; | ||
|
||
describe('getPresenceInfo', () => { | ||
it('should return the correct PresenceInfo object for each availability status', () => { | ||
// Test for 'Available' status | ||
expect(getPresenceInfo('Available')).toEqual({ | ||
icon: <Icon color="#4bb748" data={account_circle} title="Available" />, | ||
status: 'Available', | ||
}); | ||
|
||
// Add similar expect statements for other availability statuses like 'Away', 'BeRightBack', 'Busy', 'DoNotDisturb', 'Offline', and test that they return the correct PresenceInfo objects. | ||
}); | ||
|
||
it('should return the correct default PresenceInfo object for an unknown status', () => { | ||
// Test for an unknown status (status is undefined) | ||
expect(getPresenceInfo(undefined)).toEqual({ | ||
icon: <Icon data={help_outline} />, | ||
status: 'Unknown', | ||
}); | ||
|
||
// You can also add more test cases for other unknown status scenarios if needed. | ||
}); | ||
}); |
File renamed without changes.