Skip to content
Myr

Normalize behaviour

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrey Sitnik · committed by Andrey Sitnik · parent 191414f · Browse files · 3 files+46 added−51 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+46 added−51 removed

  • tests:+45 added−47 removed
  • other:+1 added−4 removed

3 files+46 added−51 removed

modified:test/benchmark.js+39 added-39 removed
modified:test/index.test.js+6 added-8 removed
1import { equal, match, notEqual, ok, throws } from 'node:assert'1import { equal, match, notEqual, ok } from 'node:assert'2import { after, before, describe, test } from 'node:test'34import * as browser from '../index.browser.js'5import * as node from '../index.js'
172 unmodified lines
178 ok(byte >= 0)179 }180 })181182 test(`${type} / customAlphabet / does not fall in infinite loop`, () => {183 equal(nanoid(0), '')184 equal(customAlphabet('abc', 0)(0), '')185 })186187 if (type === 'node') {188 test(`${type} / proxy number / prevent collision`, () => {189 let makeProxyNumberToReproducePreviousID = () => {190 let step = 0
23 unmodified lines
214 let id1 = nanoid()215 let id2 = nanoid(makeProxyNumberToReproducePreviousID())216 notEqual(id1, id2)217 })213214 test(`${type} / customAlphabet / does not fall in infinite loop`, () => {215 let generateId = customAlphabet('abc', 0)216 throws(() => {217 generateId()218 }, /ID size is 0/)219 })218 }219 })220}
modified:index.js+1 added-4 removed