Buckets:
ktongue/docker_container / .cache /opencode /node_modules /fast-json-stringify /test /infinity.test.js
| const { test } = require('node:test') | |
| const build = require('..') | |
| test('Finite numbers', t => { | |
| const values = [-5, 0, -0, 1.33, 99, 100.0, | |
| Math.E, Number.EPSILON, | |
| Number.MAX_SAFE_INTEGER, Number.MAX_VALUE, | |
| Number.MIN_SAFE_INTEGER, Number.MIN_VALUE] | |
| t.plan(values.length) | |
| const schema = { | |
| type: 'number' | |
| } | |
| const stringify = build(schema) | |
| values.forEach(v => t.assert.equal(stringify(v), JSON.stringify(v))) | |
| }) | |
| test('Infinite integers', t => { | |
| const values = [Infinity, -Infinity] | |
| t.plan(values.length) | |
| const schema = { | |
| type: 'integer' | |
| } | |
| const stringify = build(schema) | |
| values.forEach(v => { | |
| try { | |
| stringify(v) | |
| } catch (err) { | |
| t.assert.equal(err.message, `The value "${v}" cannot be converted to an integer.`) | |
| } | |
| }) | |
| }) | |
| test('Infinite numbers', t => { | |
| const values = [Infinity, -Infinity] | |
| t.plan(values.length) | |
| const schema = { | |
| type: 'number' | |
| } | |
| const stringify = build(schema) | |
| values.forEach(v => t.assert.equal(stringify(v), JSON.stringify(v))) | |
| }) | |
Xet Storage Details
- Size:
- 1.06 kB
- Xet hash:
- 2fb1783944dd840b95b3df4c80852ee617190c41da9e516800d56dfe70dab057
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.