-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
30 deletions.
There are no files selected for viewing
58 changes: 28 additions & 30 deletions
58
libs/judicial-system/types/src/lib/indictmentCase.spec.ts
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 |
---|---|---|
@@ -1,41 +1,39 @@ | ||
import { getIndictmentVerdictAppealDeadline } from './indictmentCase' | ||
import { getIndictmentVerdictAppealDeadlineStatus } from './indictmentCase' | ||
|
||
describe('getIndictmentVerdictAppealDeadline', () => { | ||
it('should return undefined if no dates are provided', () => { | ||
const result = getIndictmentVerdictAppealDeadline([]) | ||
expect(result).toBeUndefined() | ||
describe('getIndictmentVerdictAppealDeadlineStatus', () => { | ||
it('should return [true, true] if no dates are provided', () => { | ||
const result = getIndictmentVerdictAppealDeadlineStatus([]) | ||
expect(result).toEqual([true, true]) | ||
}) | ||
|
||
it('should return undefined if any dates are undefined', () => { | ||
const result1 = getIndictmentVerdictAppealDeadline([ | ||
undefined, | ||
new Date('2024-06-10T00:00:00Z'), | ||
it('should return [false, false] if any dates are undefined', () => { | ||
const result1 = getIndictmentVerdictAppealDeadlineStatus([ | ||
[true, undefined], | ||
[true, new Date('2024-06-10T00:00:00Z')], | ||
]) | ||
const result2 = getIndictmentVerdictAppealDeadline([ | ||
new Date('2024-06-10T00:00:00Z'), | ||
undefined, | ||
const result2 = getIndictmentVerdictAppealDeadlineStatus([ | ||
[true, new Date('2024-06-10T00:00:00Z')], | ||
[true, undefined], | ||
]) | ||
expect(result1).toBeUndefined() | ||
expect(result2).toBeUndefined() | ||
expect(result1).toEqual([false, false]) | ||
expect(result2).toEqual([false, false]) | ||
}) | ||
|
||
it('should return the correct deadline', () => { | ||
const dates = [ | ||
new Date('2024-06-01T00:00:00Z'), | ||
new Date('2024-06-01T00:00:00Z'), | ||
new Date('2024-06-01T00:00:00Z'), | ||
] | ||
const result = getIndictmentVerdictAppealDeadline(dates) | ||
const expectedDeadline = new Date('2024-06-29T00:00:00Z') | ||
|
||
expect(result).toStrictEqual(expectedDeadline) | ||
it('should return [true, false] if some deadline is not passed', () => { | ||
const result = getIndictmentVerdictAppealDeadlineStatus([ | ||
[true, new Date('2024-06-01T00:00:00Z')], | ||
[true, new Date()], | ||
[true, new Date('2024-06-01T00:00:00Z')], | ||
]) | ||
expect(result).toStrictEqual([true, false]) | ||
}) | ||
|
||
it('should handle a single valid date', () => { | ||
const dates = [new Date('2024-07-15T00:00:00Z')] | ||
const result = getIndictmentVerdictAppealDeadline(dates) | ||
const expectedDeadline = new Date('2024-08-12T00:00:00Z') | ||
|
||
expect(result).toStrictEqual(expectedDeadline) | ||
it('should return [true, true] if all deadlines have passed', () => { | ||
const result = getIndictmentVerdictAppealDeadlineStatus([ | ||
[true, new Date('2024-06-01T00:00:00Z')], | ||
[true, new Date('2024-06-01T00:00:00Z')], | ||
[true, new Date('2024-06-01T00:00:00Z')], | ||
]) | ||
expect(result).toStrictEqual([true, true]) | ||
}) | ||
}) |