mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2025-01-01 11:24:43 -05:00
Covered DependencyKind with tests
This commit is contained in:
parent
cb76b6f43f
commit
81b2d3df85
1 changed files with 34 additions and 0 deletions
34
test/dependency-kind.test.ts
Normal file
34
test/dependency-kind.test.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { describe, test, expect } from "@jest/globals";
|
||||
import DependencyKind from "../src/metadata/dependency-kind";
|
||||
|
||||
describe("DependencyKind.getValues", () => {
|
||||
test("all DependencyKind values are returned", () => {
|
||||
const kinds = DependencyKind.getValues();
|
||||
expect(kinds).toHaveLength(6);
|
||||
expect(kinds).toContain(DependencyKind.Depends);
|
||||
expect(kinds).toContain(DependencyKind.Recommends);
|
||||
expect(kinds).toContain(DependencyKind.Includes);
|
||||
expect(kinds).toContain(DependencyKind.Suggests);
|
||||
expect(kinds).toContain(DependencyKind.Conflicts);
|
||||
expect(kinds).toContain(DependencyKind.Breaks);
|
||||
});
|
||||
});
|
||||
|
||||
describe("DependencyKind.parse", () => {
|
||||
test("every DependencyKind can be parsed", () => {
|
||||
for (const kind of DependencyKind.getValues()) {
|
||||
expect(DependencyKind.parse(DependencyKind.toString(kind))).toStrictEqual(kind);
|
||||
}
|
||||
});
|
||||
|
||||
test("DependencyKind's name is case-insensitive", () => {
|
||||
for (const kind of DependencyKind.getValues()) {
|
||||
expect(DependencyKind.parse(DependencyKind.toString(kind).toLowerCase())).toStrictEqual(kind);
|
||||
expect(DependencyKind.parse(DependencyKind.toString(kind).toUpperCase())).toStrictEqual(kind);
|
||||
}
|
||||
});
|
||||
|
||||
test("undefined is returned when the value cannot be parsed", () => {
|
||||
expect(DependencyKind.parse("There's no such dependency kind")).toBeUndefined();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue