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

Package structure fixes #1012

Merged
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
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/e2e/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe("e2e tests for build command", () => {
expect(error).toBe("");
expect(code).toEqual(0);
expect(output).toContain(`Artifacts written to ${buildDir}`);
expect(output).toContain(`Manifest written to ${buildDir}/polywrap.json`);
expect(output).toContain(`Manifest written to ${buildDir}/wrap.info`);

testBuildOutput(testCaseDir, outputDir);
});
Expand Down
24 changes: 16 additions & 8 deletions packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Subscription
} from "../..";
import { GetPathToTestWrappers } from "@polywrap/test-cases";
import fs from "fs";

jest.setTimeout(200000);

Expand All @@ -22,8 +23,8 @@ describe("wasm-wrapper", () => {
let ethProvider: string;
let ensAddress: string;

const wrapperPath = `${GetPathToTestWrappers()}/wasm-as/simple-storage`
const wrapperUri = `fs/${wrapperPath}/build`
const wrapperPath = `${GetPathToTestWrappers()}/wasm-as/simple-storage`;
const wrapperUri = `fs/${wrapperPath}/build`;

beforeAll(async () => {
await initTestEnvironment();
Expand Down Expand Up @@ -229,18 +230,25 @@ describe("wasm-wrapper", () => {

test("getFile -- simple-storage polywrap", async () => {
const client = await getClient();
const expectedSchema = await fs.promises.readFile(
`${wrapperPath}/build/schema.graphql`,
"utf8"
);

const fileStr: string = (await client.getFile(wrapperUri, {
path: "./schema.graphql",
encoding: "utf8",
})) as string;
expect(fileStr).toContain(`type Module @imports`);

expect(fileStr).toEqual(expectedSchema);

const fileBuffer: Uint8Array = (await client.getFile(wrapperUri, {
path: "./schema.graphql",
})) as Uint8Array;
const decoder = new TextDecoder("utf8");
const text = decoder.decode(fileBuffer);
expect(text).toContain(`type Module @imports`);

expect(text).toEqual(expectedSchema);

await expect(() =>
client.getFile(new Uri("wrap://ens/ipfs.polywrap.eth"), {
Expand Down Expand Up @@ -306,8 +314,8 @@ describe("wasm-wrapper", () => {
args: {
address: address,
connection: {
networkNameOrChainId: "testnet"
}
networkNameOrChainId: "testnet",
},
},
frequency: { ms: 4500 },
});
Expand Down Expand Up @@ -384,8 +392,8 @@ describe("wasm-wrapper", () => {
args: {
address: address,
connection: {
networkNameOrChainId: "testnet"
}
networkNameOrChainId: "testnet",
},
},
frequency: { ms: 4500 },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ describe("Filesystem plugin", () => {
method: "deployContract",
args: {
connection: {
networkNameOrChainId: "testnet"
}
networkNameOrChainId: "testnet",
},
},
});

Expand All @@ -105,17 +105,16 @@ describe("Filesystem plugin", () => {

expect(manifest).toBeTruthy();
expect(manifest.version).toBe("0.0.1");
expect(manifest.type).toEqual("wasm");

// get a file
const file = await client.getFile(fsUri, {
path: "wrap.info",
});

const expectedFile = await fs.promises.readFile(
`${fsPath}/wrap.info`
);
const expectedFile = await fs.promises.readFile(`${fsPath}/wrap.info`);

const expectedInfo = Uint8Array.from(expectedFile)
const expectedInfo = Uint8Array.from(expectedFile);
expect(file).toStrictEqual(expectedInfo);
});
});