| 1 |
const normalize = require('../') |
| 2 |
const t = require('tap') |
| 3 |
|
| 4 |
// all of these just delete the bins, so expect the same value |
| 5 |
const expect = { name: 'hello', version: 'world' } |
| 6 |
|
| 7 |
t.test('no bin in object', async t => { |
| 8 |
const pkg = { name: 'hello', version: 'world' } |
| 9 |
t.strictSame(normalize(pkg), expect) |
| 10 |
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') |
| 11 |
}) |
| 12 |
|
| 13 |
t.test('empty string bin in object', async t => { |
| 14 |
const pkg = { name: 'hello', version: 'world', bin: '' } |
| 15 |
t.strictSame(normalize(pkg), expect) |
| 16 |
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') |
| 17 |
}) |
| 18 |
|
| 19 |
t.test('false bin in object', async t => { |
| 20 |
const pkg = { name: 'hello', version: 'world', bin: false } |
| 21 |
t.strictSame(normalize(pkg), expect) |
| 22 |
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') |
| 23 |
}) |
| 24 |
|
| 25 |
t.test('null bin in object', async t => { |
| 26 |
const pkg = { name: 'hello', version: 'world', bin: null } |
| 27 |
t.strictSame(normalize(pkg), expect) |
| 28 |
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') |
| 29 |
}) |
| 30 |
|
| 31 |
t.test('number bin', async t => { |
| 32 |
const pkg = { name: 'hello', version: 'world', bin: 42069 } |
| 33 |
t.strictSame(normalize(pkg), expect) |
| 34 |
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok') |
| 35 |
}) |