Skip to content

Commit

Permalink
pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jul 12, 2024
1 parent fb080f6 commit 0cb515a
Show file tree
Hide file tree
Showing 13 changed files with 1,856 additions and 29 deletions.
458 changes: 456 additions & 2 deletions examples/principal/package-lock.json

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions examples/principal/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ function getFromHexTests(principalCanister: ActorSubclass<_SERVICE>): Test {
expect(result.toHex()).toBe(principal.toHex());
});

it('converts the hex of the anonymous to a principal', async () => {
const principal = Principal.fromHex('04');

const result = await principalCanister.principalFromHex(
principal.toHex()
);

expect(result.toHex()).toBe(principal.toHex());
});

it('converts the hex of rrkah-fqaaa-aaaaa-aaaaq-cai to a principal', async () => {
const principal = Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai');

Expand Down Expand Up @@ -136,6 +146,16 @@ function getFromTextTests(principalCanister: ActorSubclass<_SERVICE>): Test {
expect(result.toText()).toBe(principal.toText());
});

it('converts "aaaaa-aa" to a principal', async () => {
const principal = Principal.fromText('2vxsx-fae');

const result = await principalCanister.principalFromText(
principal.toText()
);

expect(result.toText()).toBe(principal.toText());
});

it('converts "rrkah-fqaaa-aaaaa-aaaaq-cai" to a principal', async () => {
const principal = Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai');

Expand Down
Loading

0 comments on commit 0cb515a

Please sign in to comment.