-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert tests to Node test framework
- Loading branch information
1 parent
ca10780
commit 76d76a1
Showing
12 changed files
with
41 additions
and
40 deletions.
There are no files selected for viewing
16 changes: 9 additions & 7 deletions
16
packages/eslint-plugin-ecmascript-compat/lib/compareVersions.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
const assert = require('node:assert'); | ||
const { test } = require('node:test'); | ||
const compareVersions = require('./compareVersions'); | ||
|
||
test('equal', () => { | ||
expect(compareVersions('1.2.3', '1.2.3')).toBe(0); | ||
assert.strictEqual(compareVersions('1.2.3', '1.2.3'), 0); | ||
}); | ||
|
||
test('smaller', () => { | ||
expect(compareVersions('1.2.0', '1.2.3')).toBe(-1); | ||
expect(compareVersions('1.2', '1.3')).toBe(-1); | ||
assert.strictEqual(compareVersions('1.2.0', '1.2.3'), -1); | ||
assert.strictEqual(compareVersions('1.2', '1.3'), -1); | ||
}); | ||
|
||
test('larger', () => { | ||
expect(compareVersions('1.2.3', '1.2.0')).toBe(1); | ||
assert.strictEqual(compareVersions('1.2.3', '1.2.0'), 1); | ||
}); | ||
|
||
test('partial on one side', () => { | ||
expect(compareVersions('1.1', '1.2.3')).toBe(-1); | ||
expect(compareVersions('1.1.1', '1.2')).toBe(-1); | ||
assert.strictEqual(compareVersions('1.1', '1.2.3'), -1); | ||
assert.strictEqual(compareVersions('1.1.1', '1.2'), -1); | ||
}); | ||
|
||
test('when it matters to treat parts as numbers', () => { | ||
expect(compareVersions('9', '10')).toBe(-1); | ||
assert.strictEqual(compareVersions('9', '10'), -1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters