-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
843 additions
and
849 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
/coverage/ | ||
/.nyc_output/ | ||
/.vscode/ | ||
/cjs/ | ||
/cjs-test/ |
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,3 +1,5 @@ | ||
* | ||
*.js | ||
!.gitignore | ||
!.npmignore | ||
!test/json-ext.js | ||
!test/json-ext.min.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* global jsonExt */ | ||
import fs from 'node:fs'; | ||
import assert from 'node:assert'; | ||
|
||
describe('dist/json-ext.js', () => { | ||
before(() => new Function(fs.readFileSync('dist/json-ext.js'))()); | ||
|
||
it('stringifyChunked', () => { | ||
const expected = '{"test":"ok"}'; | ||
const actual = [...jsonExt.stringifyChunked({ test: 'ok' })].join(''); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); | ||
|
||
it('stringifyInfo', () => { | ||
const expected = '{"test":"ok"}'.length; | ||
const { minLength: actual } = jsonExt.stringifyInfo({ test: 'ok' }); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); | ||
|
||
it('parseChunked', async () => { | ||
const expected = { test: 'ok' }; | ||
const actual = await jsonExt.parseChunked(() => ['{"test"', ':"ok"}']); | ||
|
||
assert.deepStrictEqual(actual, expected); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* global jsonExt */ | ||
import fs from 'node:fs'; | ||
import assert from 'node:assert'; | ||
|
||
describe('dist/json-ext.min.js', () => { | ||
before(() => new Function(fs.readFileSync('dist/json-ext.min.js'))()); | ||
|
||
it('stringifyChunked', () => { | ||
const expected = '{"test":"ok"}'; | ||
const actual = [...jsonExt.stringifyChunked({ test: 'ok' })].join(''); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); | ||
|
||
it('stringifyInfo', () => { | ||
const expected = '{"test":"ok"}'.length; | ||
const { minLength: actual } = jsonExt.stringifyInfo({ test: 'ok' }); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); | ||
|
||
it('parseChunked', async () => { | ||
const expected = { test: 'ok' }; | ||
const actual = await jsonExt.parseChunked(() => ['{"test"', ':"ok"}']); | ||
|
||
assert.deepStrictEqual(actual, expected); | ||
}); | ||
}); |
Oops, something went wrong.