diff options
| author | underfin <2218301630@qq.com> | 2020-04-27 20:49:34 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-27 08:49:34 -0400 |
| commit | df0000ff0a3ce20292fe73b909cd31bd352d5266 (patch) | |
| tree | c97fdab1bd238e7b551a6997f589c32c7ced1305 /std/uuid/tests/v5/validate.ts | |
| parent | 516d970fd30cae6df071f6f2c8a980558b264438 (diff) | |
feat(std/uuid): Implement uuid v5 (#4916)
Diffstat (limited to 'std/uuid/tests/v5/validate.ts')
| -rw-r--r-- | std/uuid/tests/v5/validate.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/std/uuid/tests/v5/validate.ts b/std/uuid/tests/v5/validate.ts new file mode 100644 index 000000000..888acb1c5 --- /dev/null +++ b/std/uuid/tests/v5/validate.ts @@ -0,0 +1,19 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +import { assert } from "../../../testing/asserts.ts"; +import { generate, validate } from "../../v5.ts"; + +Deno.test({ + name: "[UUID] is_valid_uuid_v5", + fn(): void { + const u = generate({ + value: "Hello, World", + namespace: "1b671a64-40d5-491e-99b0-da01ff1f3341", + }) as string; + const t = "4b4f2adc-5b27-57b5-8e3a-c4c4bcf94f05"; + const n = "4b4f2adc-5b27-17b5-8e3a-c4c4bcf94f05"; + + assert(validate(u), `generated ${u} should be valid`); + assert(validate(t), `${t} should be valid`); + assert(!validate(n), `${n} should not be valid`); + }, +}); |
