Skip to content

Commit

Permalink
Merge pull request #74 from aj3sh/add-coverage
Browse files Browse the repository at this point in the history
test: added coverage for setDateObject
  • Loading branch information
aj3sh authored Jan 27, 2024
2 parents cd33ce0 + 36ab9e4 commit 93e2401
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/NepaliDate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ describe('NepaliDate', () => {
expect(n.getMilliseconds()).toBe(789)
})

it('should set date object using setDateObject', () => {
const d = new Date(373314600000)
const n = new NepaliDate()
n.setDateObject(d)
expect(n.toString()).toBe('2038-07-15 00:00:00')
expect(n.getYear()).toBe(2038)
expect(n.getEnglishYear()).toBe(1981)
expect(n.getMonth()).toBe(6)
expect(n.getEnglishMonth()).toBe(9)
expect(n.getDate()).toBe(15)
expect(n.getEnglishDate()).toBe(31)
expect(n.getDateObject().getUTCDate()).toEqual(30)
expect(n.getDay()).toBe(6)
})

it('should be initialized from fromEnglishDate', () => {
const n = NepaliDate.fromEnglishDate(2019, 2, 11, 3, 29, 38, 689)

Expand Down

0 comments on commit 93e2401

Please sign in to comment.