-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wasm templates now use app codegen for testing
- Loading branch information
1 parent
9cda933
commit 80c6eef
Showing
3 changed files
with
15 additions
and
33 deletions.
There are no files selected for viewing
16 changes: 5 additions & 11 deletions
16
packages/templates/wasm/assemblyscript/src/__tests__/e2e/integration.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
import { PolywrapClient } from "@polywrap/client-js"; | ||
import * as App from "../types/wrap"; | ||
import path from "path"; | ||
|
||
jest.setTimeout(60000); | ||
|
||
describe("Template Wrapper End to End Tests", () => { | ||
|
||
const client: PolywrapClient = new PolywrapClient(); | ||
let template: App.Template; | ||
let wrapperUri: string; | ||
|
||
beforeAll(() => { | ||
const dirname: string = path.resolve(__dirname); | ||
const wrapperPath: string = path.join(dirname, "..", "..", ".."); | ||
const wrapperPath: string = path.join(__dirname, "..", "..", ".."); | ||
wrapperUri = `fs/${wrapperPath}/build`; | ||
template = new App.Template(undefined, undefined, wrapperUri) | ||
}) | ||
|
||
it("calls sampleMethod", async () => { | ||
const expected: string = "polywrap"; | ||
|
||
const result = await client.invoke<App.Template_SampleResult>({ | ||
uri: wrapperUri, | ||
method: "sampleMethod", | ||
args: { arg: expected } | ||
}); | ||
const result = await template.sampleMethod({ arg: expected }) | ||
|
||
expect(result.ok).toBeTruthy(); | ||
if (!result.ok) return; | ||
if (!result.ok) throw result.error; | ||
expect(result.value.result).toEqual(expected); | ||
}); | ||
}); |
16 changes: 5 additions & 11 deletions
16
packages/templates/wasm/golang/module/__tests__/e2e/integration.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
import { PolywrapClient } from "@polywrap/client-js"; | ||
import * as App from "../types/wrap"; | ||
import path from "path"; | ||
|
||
jest.setTimeout(60000); | ||
|
||
describe("Template Wrapper End to End Tests", () => { | ||
|
||
const client: PolywrapClient = new PolywrapClient(); | ||
let template: App.Template; | ||
let wrapperUri: string; | ||
|
||
beforeAll(() => { | ||
const dirname: string = path.resolve(__dirname); | ||
const wrapperPath: string = path.join(dirname, "..", "..", ".."); | ||
const wrapperPath: string = path.join(__dirname, "..", "..", ".."); | ||
wrapperUri = `fs/${wrapperPath}/build`; | ||
template = new App.Template(undefined, undefined, wrapperUri) | ||
}) | ||
|
||
it("calls sampleMethod", async () => { | ||
const expected: string = "polywrap"; | ||
|
||
const result = await client.invoke<App.Template_SampleResult>({ | ||
uri: wrapperUri, | ||
method: "sampleMethod", | ||
args: { arg: expected } | ||
}); | ||
const result = await template.sampleMethod({ arg: expected }) | ||
|
||
expect(result.ok).toBeTruthy(); | ||
if (!result.ok) return; | ||
if (!result.ok) throw result.error; | ||
expect(result.value.result).toEqual(expected); | ||
}); | ||
}); |
16 changes: 5 additions & 11 deletions
16
packages/templates/wasm/typescript/src/__tests__/e2e/integration.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
import { PolywrapClient } from "@polywrap/client-js"; | ||
import * as App from "../types/wrap"; | ||
import path from "path"; | ||
|
||
jest.setTimeout(60000); | ||
|
||
describe("Template Wrapper End to End Tests", () => { | ||
|
||
const client: PolywrapClient = new PolywrapClient(); | ||
let template: App.Template; | ||
let wrapperUri: string; | ||
|
||
beforeAll(() => { | ||
const dirname: string = path.resolve(__dirname); | ||
const wrapperPath: string = path.join(dirname, "..", "..", ".."); | ||
const wrapperPath: string = path.join(__dirname, "..", "..", ".."); | ||
wrapperUri = `fs/${wrapperPath}/build`; | ||
template = new App.Template(undefined, undefined, wrapperUri) | ||
}) | ||
|
||
it("calls sampleMethod", async () => { | ||
const expected: string = "polywrap"; | ||
|
||
const result = await client.invoke<App.Template_SampleResult>({ | ||
uri: wrapperUri, | ||
method: "sampleMethod", | ||
args: { arg: expected } | ||
}); | ||
const result = await template.sampleMethod({ arg: expected }) | ||
|
||
expect(result.ok).toBeTruthy(); | ||
if (!result.ok) return; | ||
if (!result.ok) throw result.error; | ||
expect(result.value.result).toEqual(expected); | ||
}); | ||
}); |