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

Using local plugin package to test schema #1014

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
107 changes: 22 additions & 85 deletions packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,92 +85,29 @@ describe("plugin-wrapper", () => {
});

test("getSchema -- plugin schema", async () => {
const client = await getClient();
const schema: string = await client.getSchema(
"wrap://ens/js-logger.polywrap.eth"
);
const testPluginUri = "ens/test-plugin.eth";
const pluginSchema = "type Module { someMethod(arg: String): String }";

expect(schema).toStrictEqual(
`### Polywrap Header START ###
scalar UInt
scalar UInt8
scalar UInt16
scalar UInt32
scalar Int
scalar Int8
scalar Int16
scalar Int32
scalar Bytes
scalar BigInt
scalar BigNumber
scalar JSON
scalar Map

directive @imported(
uri: String!
namespace: String!
nativeType: String!
) on OBJECT | ENUM

directive @imports(
types: [String!]!
) on OBJECT

directive @capability(
type: String!
uri: String!
namespace: String!
) repeatable on OBJECT

directive @enabled_interface on OBJECT

directive @annotate(type: String!) on FIELD

### Polywrap Header END ###

type Module implements Logger_Module @imports(
types: [
"Logger_Module",
"Logger_LogLevel"
]
) {
log(
level: Logger_LogLevel!
message: String!
): Boolean!
}

### Imported Modules START ###

type Logger_Module @imported(
uri: "ens/logger.core.polywrap.eth",
namespace: "Logger",
nativeType: "Module"
) {
log(
level: Logger_LogLevel!
message: String!
): Boolean!
}

### Imported Modules END ###

### Imported Objects START ###

enum Logger_LogLevel @imported(
uri: "ens/logger.core.polywrap.eth",
namespace: "Logger",
nativeType: "LogLevel"
) {
DEBUG
INFO
WARN
ERROR
}

### Imported Objects END ###
`
);
const pluginPackage = {
factory: () => ({} as PluginModule<{}>),
manifest: {
schema: pluginSchema,
implements: [],
},
};

const client = new PolywrapClient({
plugins: [
{
uri: testPluginUri,
plugin: pluginPackage,
},
],
});

const schema: string = await client.getSchema(testPluginUri);

expect(schema).toStrictEqual(pluginSchema);
});

it("plugin map types", async () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/js/test-env/src/wrappers/ens/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@ type Module @imports(
): CreateSubdomainInOpenDomainAndSetContentHashResponse
}

type TxOverrides {
gasPrice: BigInt
gasLimit: BigInt
}

type ConfigureOpenDomainResponse {
fifsRegistrarAddress: String!
registerOpenDomainTxReceipt: Ethereum_TxResponse!
Expand All @@ -336,6 +331,11 @@ type RegistrationResult {
tx: Ethereum_TxResponse
}

type TxOverrides {
gasPrice: BigInt
gasLimit: BigInt
}

### Imported Modules START ###

type Ethereum_Module @imported(
Expand Down
Binary file modified packages/js/test-env/src/wrappers/ens/wrap.info
Binary file not shown.
14 changes: 0 additions & 14 deletions packages/test-cases/cases/cli/wasm/run/workflows/output.json

This file was deleted.

This file was deleted.

This file was deleted.