Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

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