forked from catppuccin/userstyles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalver.test.ts
More file actions
51 lines (45 loc) 路 1.27 KB
/
Copy pathcalver.test.ts
File metadata and controls
51 lines (45 loc) 路 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { CalVer } from "@/bump-version/calver.ts";
import { assertEquals } from "@std/assert";
Deno.test({
name: "constructor",
fn() {
const calver = new CalVer("2000.01.01");
assertEquals(calver.toString(), "2000.01.01");
},
});
Deno.test({
name: "incrementWith",
fn() {
const calver = new CalVer("2000.01.01");
calver.incrementWith(new Date("2000-01-01"));
assertEquals(calver.toString(), "2000.01.01.1");
calver.incrementWith(new Date("2000-01-01"));
assertEquals(calver.toString(), "2000.01.01.2");
calver.incrementWith(new Date("2000-01-02"));
assertEquals(calver.toString(), "2000.01.02");
},
});
Deno.test({
name: "incrementWith - new year",
fn() {
const calver = new CalVer("2000.12.31");
calver.incrementWith(new Date("2001-01-01"));
assertEquals(calver.toString(), "2001.01.01");
},
});
Deno.test({
name: "incrementWith - new month",
fn() {
const calver = new CalVer("2000.01.31");
calver.incrementWith(new Date("2000-02-01"));
assertEquals(calver.toString(), "2000.02.01");
},
});
Deno.test({
name: "incrementWith - earlier date",
fn() {
const calver = new CalVer("2000.01.01");
calver.incrementWith(new Date("1999-12-31"));
assertEquals(calver.toString(), "1999.12.31");
},
});