added:test/ci+42 added
1+#!/usr/bin/env node2+/* eslint-disable global-require, no-inner-declarations */3+4+if (parseInt(process.versions.node) >= 6 && false) {5+ var spawn = require('child_process').spawn6+7+ spawn('npm', ['test'], { stdio: 'inherit' }).on('exit', function (code) {8+ if (code > 0) process.exit(code)9+ })10+} else {11+ var assert = require('assert')12+ var nonSecure = require('../non-secure')13+ var nanoid = require('../')14+ var async = require('../async')15+ var url = require('../url')16+17+ var used = { }18+ function test (id) {19+ assert.ok(typeof id === 'string')20+ assert.ok(id.length === 21)21+ for (var j = 0; j < id.length; j++) {22+ assert.ok(url.indexOf(id[j]) !== -1)23+ }24+ assert.ok(!used[id])25+ used[id] = true26+ }27+28+ for (var i = 0; i < 1000; i++) {29+ test(nanoid())30+ test(nonSecure())31+ async(21, function (err, id) {32+ assert.ok(err === null)33+ test(id)34+ })35+ }36+ assert.ok(nanoid(10).length === 10)37+ assert.ok(nonSecure(10).length === 10)38+ async(10, function (err, id) {39+ assert.ok(err === null)40+ assert.ok(id.length === 10)41+ })42+}