2021-12-23 14:09:54 +00:00
|
|
|
local skynet_skylink = require("skynet.skylink")
|
2021-11-05 14:32:32 +00:00
|
|
|
|
2022-03-10 08:55:24 +00:00
|
|
|
describe("parse", function()
|
2021-11-05 14:32:32 +00:00
|
|
|
local base32 = "0404dsjvti046fsua4ktor9grrpe76erq9jot9cvopbhsvsu76r4r30"
|
|
|
|
local base64 = "AQBG8n_sgEM_nlEp3G0w3vLjmdvSZ46ln8ZXHn-eObZNjA"
|
|
|
|
|
|
|
|
it("should return unchanged base64 skylink", function()
|
2022-03-10 08:55:24 +00:00
|
|
|
assert.is.same(skynet_skylink.parse(base64), base64)
|
2021-11-05 14:32:32 +00:00
|
|
|
end)
|
2022-03-25 17:56:03 +00:00
|
|
|
|
2021-11-05 14:32:32 +00:00
|
|
|
it("should transform base32 skylink into base64", function()
|
2022-03-10 08:55:24 +00:00
|
|
|
assert.is.same(skynet_skylink.parse(base32), base64)
|
2021-12-20 10:27:29 +00:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe("hash", function()
|
|
|
|
local base64 = "EADi4QZWt87sSDCSjVTcmyI5tE_YAsuC90BcCi_jEmG5NA"
|
|
|
|
local hash = "6cfb9996ad74e5614bbb8e7228e72f1c1bc14dd9ce8a83b3ccabdb6d8d70f330"
|
|
|
|
|
|
|
|
it("should hash skylink", function()
|
|
|
|
assert.is.same(hash, skynet_skylink.hash(base64))
|
2021-11-05 14:32:32 +00:00
|
|
|
end)
|
|
|
|
end)
|