feat: Anding and or in the parsing

This commit is contained in:
BluJ
2022-07-15 13:22:42 -06:00
parent ef55bf0060
commit bd780db931
2 changed files with 35 additions and 1 deletions

View File

@@ -199,4 +199,31 @@ const { test } = Deno;
expect(checker.check("1.2.3")).toBe(true);
expect(checker.check("1")).toBe(true);
})
}
}
test(">1 && =1.2", () => {
const checker = rangeOf(">1 && =1.2");
expect(checker.check("1.2")).toBe(true);
expect(checker.check("1.2.1")).toBe(false);
})
test("=1 || =2", () => {
const checker = rangeOf("=1 || =2");
expect(checker.check("1")).toBe(true);
expect(checker.check("2")).toBe(true);
expect(checker.check("3")).toBe(false);
})
test(">1 && =1.2 || =2", () => {
const checker = rangeOf(">1 && =1.2 || =2");
expect(checker.check("1.2")).toBe(true);
expect(checker.check("1")).toBe(false);
expect(checker.check("2")).toBe(true);
expect(checker.check("3")).toBe(false);
})