Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Tests, remove tests with often changing wallet variables #101

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions js/tests/burn.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
require("dotenv").config();
import { test, jest } from "@jest/globals";
import { test, jest, expect } from "@jest/globals";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { burnDomain } from "../src/bindings/burnDomain";

jest.setTimeout(20_000);

const connection = new Connection(process.env.RPC_URL!);

const OWNER = new PublicKey("3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX");
const OWNER = new PublicKey("HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA");

const BURN_DST = new PublicKey("3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX");

test("Burn", async () => {
const tx = new Transaction();
const ix = burnDomain("1automotive", OWNER, OWNER);
const ix = burnDomain("bonfida", OWNER, BURN_DST);
tx.add(ix);
const { blockhash } = await connection.getLatestBlockhash();
tx.recentBlockhash = blockhash;
Expand Down
12 changes: 0 additions & 12 deletions js/tests/favorite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ test("Favorite domain", async () => {
stale: false,
},
},
{
user: new PublicKey("A41TAGFpQkFpJidLwH37ydunE7Q3jpBaS228RkoXiRQk"),
favorite: {
domain: new PublicKey("BaQq8Uib3Aw5SPBedC8MdYCvpfEC9iLkUMHc5M74sAjv"),
reverse: "1.00728",
stale: false,
},
},
];
for (let item of items) {
const fav = await getFavoriteDomain(connection, item.user);
Expand Down Expand Up @@ -67,10 +59,6 @@ test("Multiple favorite domains", async () => {
wallet: new PublicKey("36Dn3RWhB8x4c83W6ebQ2C2eH9sh5bQX2nMdkP2cWaA4"),
domain: "fav-tokenized",
},
{
wallet: new PublicKey("A41TAGFpQkFpJidLwH37ydunE7Q3jpBaS228RkoXiRQk"),
domain: "1.00728",
},
];
const result = await getMultipleFavoriteDomains(
connection,
Expand Down
2 changes: 1 addition & 1 deletion js/tests/nft.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require("dotenv").config();
import { test, jest } from "@jest/globals";
import { test, jest, expect, describe } from "@jest/globals";
import { PublicKey, Connection } from "@solana/web3.js";
import { getDomainKeySync } from "../src/utils/getDomainKeySync";
import { getTokenizedDomains } from "../src/utils/getTokenizedDomains";
Expand Down
57 changes: 0 additions & 57 deletions js/tests/pyth.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion js/tests/records-v2.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require("dotenv").config();
import { test, expect } from "@jest/globals";
import { test, expect, jest, describe } from "@jest/globals";
import { deserializeRecordV2Content } from "../src/record_v2/deserializeRecordV2Content";
import { getMultipleRecordsV2 } from "../src/record_v2/getMultipleRecordsV2";
import { getRecordV2 } from "../src/record_v2/getRecordV2";
Expand Down
2 changes: 1 addition & 1 deletion js/tests/registration.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require("dotenv").config();
import { test, jest } from "@jest/globals";
import { test, jest, expect } from "@jest/globals";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { registerDomainNameV2 } from "../src/bindings/registerDomainNameV2";
import { registerWithNft } from "../src/bindings/registerWithNft";
Expand Down
12 changes: 6 additions & 6 deletions js/tests/sub.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require("dotenv").config();
import { test, jest } from "@jest/globals";
import { test, jest, expect } from "@jest/globals";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { createSubdomain } from "../src/bindings/createSubdomain";
import { transferSubdomain } from "../src/bindings/transferSubdomain";
Expand Down Expand Up @@ -31,13 +31,13 @@ test("Create sub", async () => {

test("Transfer sub", async () => {
let tx = new Transaction();
const owner = new PublicKey("A41TAGFpQkFpJidLwH37ydunE7Q3jpBaS228RkoXiRQk");
const owner = new PublicKey("HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA");
const parentOwner = new PublicKey(
"A41TAGFpQkFpJidLwH37ydunE7Q3jpBaS228RkoXiRQk",
"HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA",
);
let ix = await transferSubdomain(
connection,
"test.0x33.sol",
"test.bonfida.sol",
PublicKey.default,
false,
);
Expand Down Expand Up @@ -66,9 +66,9 @@ test("Transfer sub", async () => {
test("Find sub domain", async () => {
const subs = await findSubdomains(
connection,
getDomainKeySync("bonfida").pubkey,
getDomainKeySync("67679").pubkey,
);
const expectedSub = ["dex", "naming", "test"];
const expectedSub = ["booya", "bullish", "hollaaa", "testing"];
subs.sort().forEach((e, idx) => expect(e).toBe(expectedSub[idx]));
});

Expand Down
Loading