We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a231a42 commit 22f885bCopy full SHA for 22f885b
tests/nanoid-format.test.ts
@@ -0,0 +1,16 @@
1
+import { describe, expect, test } from "bun:test";
2
+import { nanoid } from "nanoid";
3
+
4
+describe("nanoid format for drop IDs", () => {
5
+ test("custom length produces exact size", () => {
6
+ expect(nanoid(10).length).toBe(10);
7
+ expect(nanoid(21).length).toBe(21);
8
+ });
9
10
+ test("only contains URL-safe chars", () => {
11
+ for (let i = 0; i < 50; i++) {
12
+ const id = nanoid(10);
13
+ expect(id).toMatch(/^[A-Za-z0-9_-]+$/);
14
+ }
15
16
+});
0 commit comments