-
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.
- Loading branch information
1 parent
7b52e35
commit ab96c7f
Showing
11 changed files
with
80 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
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
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,3 +1,7 @@ | ||
type Module { | ||
foo(bar: String!): String! | ||
sampleMethod(arg: String!): SampleResult! | ||
} | ||
|
||
type SampleResult { | ||
result: String! | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package e2e | ||
|
||
sampleMethod: { | ||
$0: { | ||
data: { | ||
value: "polywrap from sample_method" | ||
}, | ||
error?: _|_, | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: template-wasm-ts | ||
format: 0.1.0 | ||
validation: "./polywrap.test.cue" | ||
jobs: | ||
sampleMethod: | ||
steps: | ||
- uri: fs/build | ||
method: sampleMethod | ||
args: | ||
arg: "polywrap" |
31 changes: 31 additions & 0 deletions
31
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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 wrapperUri: string; | ||
|
||
beforeAll(() => { | ||
const dirname: string = path.resolve(__dirname); | ||
const wrapperPath: string = path.join(dirname, "..", "..", ".."); | ||
wrapperUri = `fs/${wrapperPath}/build`; | ||
}) | ||
|
||
it("calls sampleMethod", async () => { | ||
const expected: string = "polywrap"; | ||
|
||
const result = await client.invoke<App.Template_SampleResult>({ | ||
uri: wrapperUri, | ||
method: "sampleMethod", | ||
args: { arg: expected } | ||
}); | ||
|
||
expect(result.ok).toBeTruthy(); | ||
if (!result.ok) return; | ||
expect(result.value.result).toEqual(expected); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/templates/wasm/typescript/src/__tests__/types/polywrap.app.yaml
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
format: 0.3.0 | ||
project: | ||
name: sample-typescript-type-generation | ||
type: app/typescript | ||
source: | ||
schema: ./schema.graphql | ||
import_abis: | ||
- uri: "wrap://ens/sample.eth" | ||
abi: "../../../build/wrap.info" |
1 change: 1 addition & 0 deletions
1
packages/templates/wasm/typescript/src/__tests__/types/schema.graphql
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
#import * into Template from "wrap://ens/sample.eth" |
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,7 +1,9 @@ | ||
import { Args_foo, ModuleBase } from "./wrap"; | ||
import { Args_sampleMethod, SampleResult, ModuleBase } from "./wrap"; | ||
|
||
export class Module extends ModuleBase { | ||
foo(args: Args_foo): string { | ||
throw new Error("Not implemented"); | ||
sampleMethod(args: Args_sampleMethod): SampleResult { | ||
return { | ||
result: args.arg, | ||
}; | ||
} | ||
} |