deno.land / std@0.224.0 / semver / difference_test.ts

difference_test.ts
View Documentation
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
// Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license.// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.import { assertEquals } from "../assert/mod.ts";import { parse } from "./parse.ts";import type { ReleaseType } from "./types.ts";import { difference } from "./difference.ts";
Deno.test("difference()", async (t) => { const versions: [string, string, ReleaseType | undefined][] = [ ["1.2.3", "0.2.3", "major"], ["1.4.5", "0.2.3", "major"], ["1.2.3", "2.0.0-pre", "premajor"], ["1.2.3", "1.3.3", "minor"], ["1.0.1", "1.1.0-pre", "preminor"], ["1.2.3", "1.2.4", "patch"], ["1.2.3", "1.2.4-pre", "prepatch"], ["0.0.1", "0.0.1-pre", "prerelease"], ["0.0.1", "0.0.1-pre-2", "prerelease"], ["1.1.0", "1.1.0-pre", "prerelease"], ["1.1.0-pre-1", "1.1.0-pre-2", "prerelease"], ["1.0.0", "1.0.0", undefined], ];
for (const [v0, v1, expected] of versions) { await t.step(`${v0}${v1}`, () => { const s0 = parse(v0); const s1 = parse(v1); const actual = difference(s0, s1); assertEquals(actual, expected); }); }});
std

Version Info

Tagged at
6 months ago