diff options
Diffstat (limited to 'spec/frontend/work_items/notes/collapse_utils_spec.js')
-rw-r--r-- | spec/frontend/work_items/notes/collapse_utils_spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/frontend/work_items/notes/collapse_utils_spec.js b/spec/frontend/work_items/notes/collapse_utils_spec.js new file mode 100644 index 00000000000..c26ef891e9f --- /dev/null +++ b/spec/frontend/work_items/notes/collapse_utils_spec.js @@ -0,0 +1,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, + ); + }); +}); |