Skip to content

Commit

Permalink
chore: add unit test and rename file
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggling committed Nov 6, 2023
1 parent 30646d5 commit 48222e5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { getPresenceInfo } from './utils/parsePresenceStatus';
import { getPresenceInfo } from './utils/parse-presence-status';
import { usePresenceQuery } from './hooks/use-presence-query';
import styled from 'styled-components';

Expand Down
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.
});
});

0 comments on commit 48222e5

Please sign in to comment.