index.js 525 B

12345678910111213
  1. 'use strict'
  2. var t = require('tap')
  3. var uniqueSlug = require('../index.js')
  4. t.plan(5)
  5. var slugA = uniqueSlug()
  6. t.is(slugA.length, 8, 'random slugs are 8 chars')
  7. t.notEqual(slugA, uniqueSlug(), "two slugs aren't the same")
  8. var base = '/path/to/thingy'
  9. var slugB = uniqueSlug(base)
  10. t.is(slugB.length, 8, 'string based slugs are 8 chars')
  11. t.is(slugB, uniqueSlug(base), 'two string based slugs, from the same string are the same')
  12. t.notEqual(slugB, uniqueSlug(slugA), 'two string based slongs, from diff strings are different')