• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1const normalize = require('../')
2const t = require('tap')
3
4// all of these just delete the bins, so expect the same value
5const expect = { name: 'hello', version: 'world' }
6
7t.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
13t.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
19t.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
25t.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
31t.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})
36