Skip to content
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
968 changes: 488 additions & 480 deletions legacy_packages/storage/test/ipfs.test.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { prepareAutoFactoryDeployTransaction } from "./deploy-via-autofactory.js
import { initialize } from "../../extensions/prebuilts/__generated__/DropERC721/write/initialize.js";
import { getDeployedInfraContract } from "./utils/infra.js";

describe("deployFromMetadata", () => {
// skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("deployFromMetadata", () => {
it("should deploy published contract with existing infra", async () => {
const cloneFactoryContract = await getDeployedCloneFactoryContract({
chain: FORKED_ETHEREUM_CHAIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { getDeployedCreate2Factory } from "./create-2-factory.js";
import { getDeployedInfraContract } from "./infra.js";
import { fail } from "assert";

describe("bootstrap", () => {
// skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("bootstrap", () => {
it("should bootstrap onchain infra", async () => {
await deployCloneFactory({
chain: ANVIL_CHAIN,
Expand Down
4 changes: 3 additions & 1 deletion packages/thirdweb/src/event/actions/get-events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {
import { transferEvent } from "../../extensions/erc721/__generated__/IERC721A/events/Transfer.js";
import { prepareEvent } from "../prepare-event.js";

describe("getEvents", () => {
// skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("getEvents", () => {
it("should get all events", async () => {
const events = await getContractEvents({
contract: USDC_CONTRACT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { describe, it, expect } from "vitest";
import { resolveAddress } from "./resolve-address.js";
import { TEST_CLIENT } from "../../../test/src/test-clients.js";

describe("ENS", () => {
// skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("ENS", () => {
it("should resolve ENS", async () => {
const name = "vitalik.eth";
const address = await resolveAddress({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getNFT } from "./getNFT.js";
import { DROP1155_CONTRACT } from "~test/test-contracts.js";

describe("erc1155.getNFT", () => {
it.runIf(process.env.TW_SECRET_KEY)("without owner", async () => {
it("without owner", async () => {
const nft = await getNFT({
contract: DROP1155_CONTRACT,
tokenId: 2n,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, it, expect } from "vitest";
import { getAllOwners } from "./getAllOwners.js";
import { AZUKI_CONTRACT, DOODLES_CONTRACT } from "~test/test-contracts.js";

describe.runIf(process.env.TW_SECRET_KEY)("erc721.getAllOwners", () => {
describe("erc721.getAllOwners", () => {
it("works for azuki", async () => {
const nfts = await getAllOwners({
contract: AZUKI_CONTRACT,
Expand Down
4 changes: 2 additions & 2 deletions packages/thirdweb/src/extensions/erc721/read/getNFT.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getNFT } from "./getNFT.js";
import { DOODLES_CONTRACT } from "~test/test-contracts.js";

describe("erc721.getNFT", () => {
it.runIf(process.env.TW_SECRET_KEY)("without owner", async () => {
it("without owner", async () => {
const nft = await getNFT({
contract: { ...DOODLES_CONTRACT },
tokenId: 1n,
Expand Down Expand Up @@ -47,7 +47,7 @@ describe("erc721.getNFT", () => {
`);
});

it.runIf(process.env.TW_SECRET_KEY)("with owner", async () => {
it("with owner", async () => {
const nft = await getNFT({
contract: { ...DOODLES_CONTRACT },
tokenId: 1n,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, it, expect } from "vitest";
import { getNFTs } from "./getNFTs.js";
import { AZUKI_CONTRACT, DOODLES_CONTRACT } from "~test/test-contracts.js";

describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
describe("erc721.getNFTs", () => {
it("works for azuki", async () => {
const nfts = await getNFTs({
contract: AZUKI_CONTRACT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { USDC_CONTRACT_ADDRESS } from "../../../../test/src/test-contracts.js";
import { toHex } from "../../../utils/encoding/hex.js";
import { sendTransaction } from "../../../transaction/actions/send-transaction.js";

describe(
// skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)(
"generateMintSignature",
{
timeout: 60000,
Expand Down
82 changes: 39 additions & 43 deletions packages/thirdweb/src/extensions/prebuilts/deploy-erc1155.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,49 @@ import { deployERC1155Contract } from "./deploy-erc1155.js";
import { name } from "../common/read/name.js";
import { getContract } from "../../contract/contract.js";

describe(
"deployERC1155",
{
retry: 0,
},
() => {
it("should deploy ERC1155 drop", async () => {
const address = await deployERC1155Contract({
// skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("deployERC1155", () => {
it("should deploy ERC1155 drop", async () => {
const address = await deployERC1155Contract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "DropERC1155",
params: {
name: "EditionDrop",
symbol: "NFTD",
},
});
expect(address).toBe("0xd91A47278829a0128D7212225FE74BC153A7FAF8");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "DropERC1155",
params: {
name: "EditionDrop",
symbol: "NFTD",
},
});
expect(address).toBe("0xd91A47278829a0128D7212225FE74BC153A7FAF8");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
address,
}),
});
expect(deployedName).toBe("EditionDrop");
address,
}),
});
expect(deployedName).toBe("EditionDrop");
});

it("should deploy ERC1155 token", async () => {
const address = await deployERC1155Contract({
it("should deploy ERC1155 token", async () => {
const address = await deployERC1155Contract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "TokenERC1155",
params: {
name: "Edition",
},
});
expect(address).toBe("0x7dD915A335Af52698bFFFE14D1D3F0DCfdC0a8E6");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "TokenERC1155",
params: {
name: "Edition",
},
});
expect(address).toBe("0x7dD915A335Af52698bFFFE14D1D3F0DCfdC0a8E6");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
address,
}),
});
expect(deployedName).toBe("Edition");
address,
}),
});
},
);
expect(deployedName).toBe("Edition");
});
});
82 changes: 39 additions & 43 deletions packages/thirdweb/src/extensions/prebuilts/deploy-erc20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,49 @@ import { deployERC20Contract } from "./deploy-erc20.js";
import { name } from "../common/read/name.js";
import { getContract } from "../../contract/contract.js";

describe(
"deployERC20",
{
retry: 0,
},
() => {
it("should deploy ERC20 drop", async () => {
const address = await deployERC20Contract({
// skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("deployERC20", () => {
it("should deploy ERC20 drop", async () => {
const address = await deployERC20Contract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "DropERC20",
params: {
name: "TokenDrop",
symbol: "NFTD",
},
});
expect(address).toBe("0x61Ae22E7240C7e5853749AF49f2552CB8D7C3e35");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "DropERC20",
params: {
name: "TokenDrop",
symbol: "NFTD",
},
});
expect(address).toBe("0x61Ae22E7240C7e5853749AF49f2552CB8D7C3e35");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
address,
}),
});
expect(deployedName).toBe("TokenDrop");
address,
}),
});
expect(deployedName).toBe("TokenDrop");
});

it("should deploy ERC20 token", async () => {
const address = await deployERC20Contract({
it("should deploy ERC20 token", async () => {
const address = await deployERC20Contract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "TokenERC20",
params: {
name: "Token",
},
});
expect(address).toBe("0x3E8437C96275E9873b0379c1e5d5F0998A9546e9");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
account: TEST_ACCOUNT_A,
type: "TokenERC20",
params: {
name: "Token",
},
});
expect(address).toBe("0x3E8437C96275E9873b0379c1e5d5F0998A9546e9");
const deployedName = await name({
contract: getContract({
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
address,
}),
});
expect(deployedName).toBe("Token");
address,
}),
});
},
);
expect(deployedName).toBe("Token");
});
});
Loading