-
Notifications
You must be signed in to change notification settings - Fork 392
Expand file tree
/
Copy pathutils.test.ts
More file actions
102 lines (67 loc) · 2.47 KB
/
utils.test.ts
File metadata and controls
102 lines (67 loc) · 2.47 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { expect, test } from "vitest";
import { BumpLevels, getChangelogEntry, sortTheThings } from "./utils.ts";
let changelog = `# @keystone-alpha/email
## 3.0.1
### Patch Changes
- [19fe6c1b](https://github.com/keystonejs/keystone-5/commit/19fe6c1b):
Move frontmatter in docs into comments
## 3.0.0 (2026-02-27)
### Major Changes
- [2164a779](https://github.com/keystonejs/keystone-5/commit/2164a779):
- Replace jade with pug because Jade was renamed to Pug, and \`jade\` package is outdated
### Patch Changes
- [81dc0be5](https://github.com/keystonejs/keystone-5/commit/81dc0be5):
- Update dependencies
## 2.0.0
- [patch][b69fb9b7](https://github.com/keystonejs/keystone-5/commit/b69fb9b7):
- Update dev devependencies
- [major][f97e4ecf](https://github.com/keystonejs/keystone-5/commit/f97e4ecf):
- Export { emailSender } as the API, rather than a default export
## 1.0.2
- [patch][7417ea3a](https://github.com/keystonejs/keystone-5/commit/7417ea3a):
- Update patch-level dependencies
## 1.0.1
- [patch][1f0bc236](https://github.com/keystonejs/keystone-5/commit/1f0bc236):
- Update the package.json author field to "The Keystone Development Team"
## 1.0.0
- [major] 8b6734ae:
- This is the first release of keystone-alpha (previously voussoir).
All packages in the \`@voussoir\` namespace are now available in the \`@keystone-alpha\` namespace, starting at version \`1.0.0\`.
To upgrade your project you must update any \`@voussoir/<foo>\` dependencies in \`package.json\` to point to \`@keystone-alpha/<foo>: "^1.0.0"\` and update any \`require\`/\`import\` statements in your code.
# @voussoir/email
## 0.0.2
- [patch] 113e16d4:
- Remove unused dependencies
- [patch] 625c1a6d:
- Update mjml-dependency
`;
test("it works", () => {
let entry = getChangelogEntry(changelog, "3.0.0");
expect(entry.content).toMatchSnapshot();
expect(entry.highestLevel).toBe(BumpLevels.major);
});
test("it works", () => {
let entry = getChangelogEntry(changelog, "3.0.1");
expect(entry.content).toMatchSnapshot();
expect(entry.highestLevel).toBe(BumpLevels.patch);
});
test("it sorts the things right", () => {
let things = [
{
name: "a",
highestLevel: BumpLevels.major,
private: true,
},
{
name: "b",
highestLevel: BumpLevels.patch,
private: false,
},
{
name: "c",
highestLevel: BumpLevels.major,
private: false,
},
];
expect(things.sort(sortTheThings)).toMatchSnapshot();
});