-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add `type` arg to Node for specifying resource/data - Added `--resource` & `--data` flags to CLI usage - Removed hardcoded pack format end snapshot
- Loading branch information
Showing
5 changed files
with
64 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
const packFormat = require('./') | ||
|
||
let total = 0, passed = 0, failed = 0 | ||
const test = (input, expected) => { | ||
let ver = packFormat(input) | ||
const test = ([input, type], expected) => { | ||
let ver = packFormat(input, type) | ||
let pass = ver == expected | ||
if (pass) passed++ | ||
else failed++ | ||
total++ | ||
console.log(`${pass ? '+' : '-'} Pack format of ${input} is ${ver}`) | ||
console.log( | ||
(pass ? ' ' : '! ') | ||
+ (type ? type[0].toUpperCase() + type.substr(1) + ' p' : 'P') | ||
+ `ack format of ${input} is ${ver}` | ||
+ (!pass ? ` (should be ${expected})` : '') | ||
) | ||
} | ||
|
||
test('1.1', null) | ||
test('1.6', 1) | ||
test('1.9', 2) | ||
test('1.16.1', 5) | ||
test('1.16.3', 6) | ||
test('1.16.2-pre1', 5) | ||
test('1.30', null) | ||
test('11w50a', null) | ||
test('20w30a', 6) | ||
test('99w99a', null) | ||
test([null], null) | ||
test(['invalid'], null) | ||
test(['1'], null) | ||
test(['1.1'], null) | ||
test(['1.6'], 1) | ||
test(['1.9'], 2) | ||
test(['1.16.1'], 5) | ||
test(['1.16.3'], 6) | ||
test(['1.16.2-pre1'], 5) | ||
test(['1.30'], null) | ||
test(['11w50a'], null) | ||
test(['13w23a'], null) | ||
test(['13w24a'], 1) | ||
test(['16w31a'], 2) | ||
test(['16w32a'], 3) | ||
test(['20w30a'], 5) | ||
test(['20w45a'], 7) | ||
test(['20w45a', 'resource'], 7) | ||
test(['20w45a', 'data'], 6) | ||
test(['20w46a', 'data'], 7) | ||
|
||
console.log(`\nRan ${total} tests | ${passed} passed | ${failed} failed`) |