Skip to content

Commit

Permalink
add test for decoding drep ids
Browse files Browse the repository at this point in the history
  • Loading branch information
twwu123 committed Nov 29, 2024
1 parent e2d2889 commit d55367a
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions packages/mesh-core-csl/test/utils/drep.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { getDRepIds } from "@meshsdk/core-csl";

describe("DRep", () => {
test("Get DRepIds of a CIP105 script", () => {
expect(
getDRepIds(
"drep_script190xv8v32n43luhu9ag05s5mvcs6079lg4zghzyg3j9vlgle68y3",
),
).toEqual({
cip105: "drep_script190xv8v32n43luhu9ag05s5mvcs6079lg4zghzyg3j9vlgle68y3",
cip129: "drep1yv4uesaj92wk8ljlsh4p7jzndnzrflchaz5fzug3zxg4naqkpeas3",
});
});

test("Get DRepIds of a CIP129 script", () => {
expect(
getDRepIds("drep1yv4uesaj92wk8ljlsh4p7jzndnzrflchaz5fzug3zxg4naqkpeas3"),
).toEqual({
cip105: "drep_script190xv8v32n43luhu9ag05s5mvcs6079lg4zghzyg3j9vlgle68y3",
cip129: "drep1yv4uesaj92wk8ljlsh4p7jzndnzrflchaz5fzug3zxg4naqkpeas3",
});
});

test("Get DRepIds of a CIP105 key hash", () => {
expect(
getDRepIds("drep100gzgh095hxsgarhdvacsz8m98sdwkyhm5924w74au5djs8u5ud"),
).toEqual({
cip105: "drep100gzgh095hxsgarhdvacsz8m98sdwkyhm5924w74au5djs8u5ud",
cip129: "drep1yfaaqfzaukju6pr5wa4nhzqglv57p46cjlws424m6hhj3kg2k9vj7",
});
});

test("Get DRepIds of a CIP129 key hash", () => {
expect(
getDRepIds("drep1yfaaqfzaukju6pr5wa4nhzqglv57p46cjlws424m6hhj3kg2k9vj7"),
).toEqual({
cip105: "drep100gzgh095hxsgarhdvacsz8m98sdwkyhm5924w74au5djs8u5ud",
cip129: "drep1yfaaqfzaukju6pr5wa4nhzqglv57p46cjlws424m6hhj3kg2k9vj7",
});
});
});

0 comments on commit d55367a

Please sign in to comment.