Files
gramps-web/test/unit/date.test.js
David Straub 75c5866d55 Switch to vitest for unit tests (#978)
* Start adding unit tests with vitest

* Run tests in CI

* Fix test
2026-03-08 14:59:26 +01:00

25 lines
640 B
JavaScript

import {describe, it, expect} from 'vitest'
import {toDate} from '../../src/date.js'
describe('toDate', () => {
it('formats a normal date', () => {
expect(toDate([15, 6, 1985])).to.equal('1985-6-15')
})
it('formats day/month zero (year only)', () => {
expect(toDate([0, 0, 1900])).to.equal('1900-0-0')
})
it('returns empty string for undefined', () => {
expect(toDate(undefined)).to.equal('')
})
it('returns empty string for null', () => {
expect(toDate(null)).to.equal('')
})
it('returns empty string for empty array', () => {
expect(toDate([])).to.equal('undefined-undefined-undefined')
})
})