Skip to content

Commit

Permalink
test: isMain
Browse files Browse the repository at this point in the history
  • Loading branch information
Th0rgal committed Dec 14, 2023
1 parent 5f47758 commit 4c049f2
Showing 1 changed file with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Identity } from "../../utils/apiWrappers/identity";
import { Identity } from "../../../utils/apiWrappers/identity";
require("dotenv").config({ path: ".env.test" });

describe("Should test Identity object", () => {
Expand All @@ -23,6 +23,16 @@ describe("Should test Identity object", () => {
const identity = new Identity(getSampleData1());
expect(identity.pop).toEqual(false);
});

it("Should ensures my domain is main", () => {
const identity = new Identity(getSampleData1());
expect(identity.isMain).toEqual(true);
});

it("Should ensures my domain is not main", () => {
const identity = new Identity(getSampleData2());
expect(identity.isMain).toEqual(false);
});
});

function getSampleData1(): IdentityData {
Expand Down Expand Up @@ -110,3 +120,24 @@ function getSampleData1(): IdentityData {
],
};
}

function getSampleData2(): IdentityData {
return {
id: "0x0000000000000000000000000000000000000000000000000000000000000001",
owner: "0x00a00373a00352aa367058555149b573322910d54fcdf3a926e3e56d0dcb4b0c",
main: false,
creation_date: 1671228830,
domain: {
domain: "th0rgal.stark",
root: true,
creation_date: 1671228943,
expiry: 1828908943,
resolver:
"0x03c571617caa8578c5cf9ded5e238b3190e6efd60e73643bb4cff9f374978026",
legacy_address: "0x123",
rev_address: "0x456",
},
user_data: [],
verifier_data: [],
};
}

0 comments on commit 4c049f2

Please sign in to comment.