Skip to content

Commit

Permalink
added additional tests to getDateOfGame unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyrushton committed Jan 25, 2024
1 parent 005e918 commit e5beefb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions __tests__/lib/getDateOfGame.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ describe('getDateOfGame()', () => {
expect(date3.getFullYear()).toBe(2023)
const date4 = getDateOfGame('12/12')
expect(date4.getFullYear()).toBe(2023)
const date5 = getDateOfGame('10 Oct')
expect(date5.getFullYear()).toBe(2023)
const date6 = getDateOfGame('25 Oct')
expect(date6.getFullYear()).toBe(2023)
const date7 = getDateOfGame('12 Nov')
expect(date7.getFullYear()).toBe(2023)
const date8 = getDateOfGame('12 Dec')
expect(date8.getFullYear()).toBe(2023)
})

it('should return a date object with the correct date when year ahead', () => {
Expand All @@ -29,6 +37,14 @@ describe('getDateOfGame()', () => {
expect(date3.getFullYear()).toBe(2023)
const date4 = getDateOfGame('12/12')
expect(date4.getFullYear()).toBe(2023)
const date5 = getDateOfGame('10 Oct')
expect(date5.getFullYear()).toBe(2023)
const date6 = getDateOfGame('25 Oct')
expect(date6.getFullYear()).toBe(2023)
const date7 = getDateOfGame('12 Nov')
expect(date7.getFullYear()).toBe(2023)
const date8 = getDateOfGame('12 Dec')
expect(date8.getFullYear()).toBe(2023)
})

it('should return a date object with the correct date when year behind', () => {
Expand All @@ -41,5 +57,13 @@ describe('getDateOfGame()', () => {
expect(date3.getFullYear()).toBe(2024)
const date4 = getDateOfGame('03/12')
expect(date4.getFullYear()).toBe(2024)
const date5 = getDateOfGame('01 Jan')
expect(date5.getFullYear()).toBe(2024)
const date6 = getDateOfGame('25 Jan')
expect(date6.getFullYear()).toBe(2024)
const date7 = getDateOfGame('12 Feb')
expect(date7.getFullYear()).toBe(2024)
const date8 = getDateOfGame('12 Mar')
expect(date8.getFullYear()).toBe(2024)
})
})

0 comments on commit e5beefb

Please sign in to comment.