Skip to content

Commit

Permalink
add back wrong test cases with fixed expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k committed Feb 16, 2024
1 parent ad8dd2d commit a69689b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions semver/test_range_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parse } from "./parse.ts";
import { parseRange } from "./parse_range.ts";
import { testRange } from "./test_range.ts";

Deno.test("range", async (t) => {
Deno.test("testRange() returns true when the version is in the range", async (t) => {
const versions: [string, string][] = [
["1.0.0 - 2.0.0", "1.2.3"],
["^1.2.3+build", "1.2.3"],
Expand Down Expand Up @@ -100,14 +100,15 @@ Deno.test("range", async (t) => {
});

Deno.test({
name: "negativeRange",
name: "testRange() returns false when the version is not in the range",
fn: async (t) => {
const versions: [string, string][] = [
["1.0.0 - 2.0.0", "2.2.3"],
["1.2.3+asdf - 2.4.3+asdf", "1.2.3-pre.2"],
["^1.2.3+build", "2.0.0"],
["^1.2.3+build", "1.2.0"],
["1.2.3-pre+asdf - 2.4.3-pre+asdf", "2.4.3"],
["1.2.3+asdf - 2.4.3+asdf", "2.4.3-alpha"],
["^1.2.3", "1.2.3-pre"],
["^1.2", "1.2.0-pre"],
[">1.2", "1.3.0-beta"],
Expand Down Expand Up @@ -167,6 +168,14 @@ Deno.test({
["^1.2.3", "1.2.2"],
["^1.2", "1.1.9"],

// unsatisfiable patterns with prereleases
["*", "1.0.0-rc1"],
["^1.0.0-0", "1.0.1-rc1"],
["^1.0.0-rc2", "1.0.1-rc1"],
["^1.0.0", "1.0.1-rc1"],
["^1.0.0", "1.1.0-rc1"],
["<=1.2.3", "1.2.3-beta"],

// invalid ranges never satisfied!
["blerg", "1.2.3"],
["^1.2.3", "2.0.0-pre"],
Expand Down

0 comments on commit a69689b

Please sign in to comment.