Skip to content

Commit 014a293

Browse files
committed
Add unit tests for dateFormatter
1 parent ed39cc4 commit 014a293

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { describe, expect, it } from 'vitest';
2+
3+
import { formatMonth, formatShortMonth } from './dateFormatter.js';
4+
5+
describe('formatMonth', () => {
6+
it('returns proper month name', () => {
7+
const date = new Date(2017, 1, 1);
8+
9+
const formattedDate = formatMonth('en-US', date);
10+
11+
expect(formattedDate).toBe('February');
12+
});
13+
});
14+
15+
describe('formatShortMonth', () => {
16+
it('returns proper short month name', () => {
17+
const date = new Date(2017, 1, 1);
18+
19+
const formattedDate = formatShortMonth('en-US', date);
20+
21+
expect(formattedDate).toBe('Feb');
22+
});
23+
});

0 commit comments

Comments
 (0)