-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from ecaron/setAsString
Introducing an option to convert BigInts to strings
- Loading branch information
Showing
3 changed files
with
53 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var mocha = require('mocha') | ||
, assert = require('chai').assert | ||
, expect = require('chai').expect | ||
; | ||
|
||
describe("Testing 'storeAsString' option", function(){ | ||
var key = '{ "key": 12345678901234567 }'; | ||
it("Should show that the key is of type object", function(done){ | ||
var JSONbig = require('../index'); | ||
var result = JSONbig.parse(key); | ||
expect(typeof result.key).to.equal("object"); | ||
done(); | ||
}); | ||
|
||
it("Should show that key is of type string, when storeAsString option is true", function(done){ | ||
var JSONstring = require('../index')({"storeAsString": true}); | ||
var result = JSONstring.parse(key); | ||
expect(typeof result.key).to.equal("string"); | ||
done(); | ||
}); | ||
}); |