File: test.js

package info (click to toggle)
node-unique-string 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 140 kB
  • sloc: javascript: 35; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 364 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const test = require('tape');
const uniqueString = require('.');

test('main', t => {
	t.is(uniqueString().length, 32);

	const created = new Set();

	for (let i = 0; i < 100000; i++) {
		const string = uniqueString();

		if (created.has(string)) {
			t.fail(`${string} already exists`);
		}

		t.is(string.length, 32);

		created.add(string);
	}
    t.end();
});