bug修复
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Qumolama.d 2022-05-03 19:05:28 +08:00
parent 3b8712a212
commit 594fbdc75b
Signed by: Lama3L9R
GPG Key ID: 1762AFC05157CE18
4 changed files with 23 additions and 4 deletions

View File

@ -8,7 +8,7 @@ name: test
steps:
- name: install
image: node16-alpine
image: node:16
commands:
- yarn install
- yarn test
@ -39,6 +39,6 @@ steps:
```
🌐 {{ build.link }}
{{/success}}

View File

@ -19,7 +19,7 @@ export function uuid(input) {
export function noSymboUUID(input) {
let md5Bytes = Crypto.createHash('md5').update(input).digest()
md5Bytes[6] &= 0x0f; // clear version
md5Bytes[6] &= 0x0f; // clear versio\n
md5Bytes[6] |= 0x30; // set to version 3
md5Bytes[8] &= 0x3f; // clear variant
md5Bytes[8] |= 0x80; // set to IETF variant
@ -27,7 +27,7 @@ export function noSymboUUID(input) {
}
export function uuidToNoSymboUUID(uuid) {
return uuid.replace('-', '')
return uuid.replace(/-/g, '')
}
export function toSymboUUID(uuid) {

3
src/test.js Normal file
View File

@ -0,0 +1,3 @@
import * as Server from './index.js'
console.log(Server)

View File

@ -12,4 +12,20 @@ test("generateToken", () => {
}
expect(new Set(tokens).size === tokens.length).toBeTruthy()
})
test("uuid", () => {
expect(Generator.uuid("test")).toBe("098f6bcd-4621-3373-8ade-4e832627b4f6")
})
test("noSymbolUUID", () => {
expect(Generator.noSymboUUID("test")).toBe("098f6bcd462133738ade4e832627b4f6")
})
test("uuidToNoSymboUUID", () => {
expect(Generator.uuidToNoSymboUUID("098f6bcd-4621-3373-8ade-4e832627b4f6")).toBe("098f6bcd462133738ade4e832627b4f6")
})
test("toSymboUUID", () => {
expect(Generator.toSymboUUID("098f6bcd462133738ade4e832627b4f6")).toBe("098f6bcd-4621-3373-8ade-4e832627b4f6")
})