-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.test.ts
More file actions
28 lines (25 loc) · 862 Bytes
/
main.test.ts
File metadata and controls
28 lines (25 loc) · 862 Bytes
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
import { describe, it } from "testing/bdd";
import { assertEquals } from "@std/assert";
describe("main", () => {
it("MAIN00 - filters empty arguments", () => {
const args = ["get", "", " ", "major"];
const filtered = args
.filter((arg) => arg?.trim())
.filter((arg) => arg !== "--");
assertEquals(filtered, ["get", "major"]);
});
it("MAIN01 - filters -- argument", () => {
const args = ["get", "--", "major"];
const filtered = args
.filter((arg) => arg?.trim())
.filter((arg) => arg !== "--");
assertEquals(filtered, ["get", "major"]);
});
it("MAIN02 - preserves valid arguments", () => {
const args = ["get", "major", "--json"];
const filtered = args
.filter((arg) => arg?.trim())
.filter((arg) => arg !== "--");
assertEquals(filtered, ["get", "major", "--json"]);
});
});