blob: c26ef891e9f1454a918d2f4ab594807c580a2ebb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import {
isDescriptionSystemNote,
getTimeDifferenceInMinutes,
} from '~/work_items/notes/collapse_utils';
import { workItemSystemNoteWithMetadata } from '../mock_data';
describe('Work items collapse utils', () => {
it('checks if a system note is of a description type', () => {
expect(isDescriptionSystemNote(workItemSystemNoteWithMetadata)).toEqual(true);
});
it('returns false when a system note is not a description type', () => {
expect(isDescriptionSystemNote({ ...workItemSystemNoteWithMetadata, system: false })).toEqual(
false,
);
});
it('gets the time difference between two notes', () => {
const anotherSystemNote = {
...workItemSystemNoteWithMetadata,
createdAt: '2023-05-06T07:19:37Z',
};
// kept the dates 24 hours apart so 24 * 60 mins = 1440
expect(getTimeDifferenceInMinutes(workItemSystemNoteWithMetadata, anotherSystemNote)).toEqual(
1440,
);
});
});
|