Skip to content

Commit fb2f271

Browse files
committed
chore: fix tests
1 parent f2cb14c commit fb2f271

7 files changed

Lines changed: 20 additions & 18 deletions

File tree

packages/client/src/PolywrapClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { InvokerOptions, TryResolveUriOptions } from "./types";
2-
import { ClientConfigBuilder } from ".";
32

43
import { PolywrapCoreClient } from "@polywrap/core-client-js";
54
import {
@@ -25,6 +24,7 @@ import {
2524
WrapManifest,
2625
} from "@polywrap/wrap-manifest-types-js";
2726
import { Tracer, TracerConfig } from "@polywrap/tracing-js";
27+
import { ClientConfigBuilder } from "@polywrap/client-config-builder-js";
2828

2929
export class PolywrapClient extends PolywrapCoreClient {
3030
// $start: PolywrapClient-constructor

packages/client/src/__tests__/core/error-structure.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ describe("Error structure", () => {
266266
});
267267

268268
afterAll(() => {
269-
fs.rmdirSync("tmp", { recursive: true });
269+
fs.rmSync("tmp", { recursive: true });
270270
});
271271
});
272272
});
@@ -415,7 +415,7 @@ describe("Error structure", () => {
415415
test("Invoke a plugin wrapper with malformed args", async () => {
416416
const client = await createClient();
417417
const result = await client.invoke<Uint8Array>({
418-
uri: SysNodeBundle.plugins.fileSystem.uri,
418+
uri: SysNodeBundle.bundle.fileSystem.uri,
419419
method: "readFile",
420420
args: {
421421
pathh: "packages/client/src/__tests__/core/index.ts",
@@ -432,7 +432,7 @@ describe("Error structure", () => {
432432
expect(result.error?.reason).toEqual(
433433
'The "path" argument must be of type string or an instance of Buffer or URL. Received undefined'
434434
);
435-
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.plugins.fileSystem.uri).uri);
435+
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.bundle.fileSystem.uri).uri);
436436
expect(result.error?.method).toEqual("readFile");
437437
expect(result.error?.args).toContain(
438438
'{\n "pathh": "packages/client/src/__tests__/core/index.ts"\n}'
@@ -445,7 +445,7 @@ describe("Error structure", () => {
445445
test("Invoke a plugin wrapper with a method that doesn't exist", async () => {
446446
const client = await createClient();
447447
const result = await client.invoke<Uint8Array>({
448-
uri: SysNodeBundle.plugins.fileSystem.uri,
448+
uri: SysNodeBundle.bundle.fileSystem.uri,
449449
method: "readFileNotFound",
450450
args: {
451451
path: __dirname + "/index.ts",
@@ -462,7 +462,7 @@ describe("Error structure", () => {
462462
expect(
463463
result.error?.reason.startsWith("Plugin missing method ")
464464
).toBeTruthy();
465-
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.plugins.fileSystem.uri).uri);
465+
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.bundle.fileSystem.uri).uri);
466466
expect(result.error?.method).toEqual("readFileNotFound");
467467
});
468468

@@ -494,7 +494,7 @@ describe("Error structure", () => {
494494
test("Invoke a plugin wrapper that throws unexpectedly", async () => {
495495
const client = await createClient();
496496
const result = await client.invoke<Uint8Array>({
497-
uri: SysNodeBundle.plugins.fileSystem.uri,
497+
uri: SysNodeBundle.bundle.fileSystem.uri,
498498
method: "readFile",
499499
args: {
500500
path: "./this/path/does/not/exist.ts",
@@ -511,7 +511,7 @@ describe("Error structure", () => {
511511
expect(
512512
result.error?.reason.startsWith("ENOENT: no such file or directory")
513513
).toBeTruthy();
514-
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.plugins.fileSystem.uri).uri);
514+
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.bundle.fileSystem.uri).uri);
515515
expect(result.error?.method).toEqual("readFile");
516516
expect(result.error?.args).toEqual(
517517
'{\n "path": "./this/path/does/not/exist.ts"\n}'

packages/client/src/__tests__/core/plugin-wrapper.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PolywrapClient } from "../..";
2-
import { Uri } from "@polywrap/core-js";
2+
import { IWrapPackage, Uri } from "@polywrap/core-js";
33
import { WrapManifest } from "@polywrap/wrap-manifest-types-js";
44
import { PluginPackage, PluginModule } from "@polywrap/plugin-js";
55
import { UriResolver } from "@polywrap/uri-resolvers-js";
@@ -81,11 +81,14 @@ describe("plugin-wrapper", () => {
8181
const client = new PolywrapClient(
8282
{
8383
resolver: UriResolver.from([
84-
{ uri: Uri.from(SysBundle.plugins.http.uri), package: SysBundle.plugins.http.plugin },
84+
{
85+
uri: Uri.from(SysBundle.bundle.http.uri),
86+
package: SysBundle.bundle.http.package as IWrapPackage
87+
},
8588
]),
8689
}
8790
);
88-
const manifest = await client.getManifest(SysBundle.plugins.http.uri);
91+
const manifest = await client.getManifest(SysBundle.bundle.http.uri);
8992
if (!manifest.ok) fail(manifest.error);
9093
expect(manifest.value.type).toEqual("plugin");
9194
expect(manifest.value.name).toEqual("Http");

packages/client/src/__tests__/core/wasm-wrapper.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,13 @@ describe("wasm-wrapper", () => {
116116
});
117117

118118
it("should allow clone + reconfigure of redirects", async () => {
119-
let config = new ClientConfigBuilder()
119+
let builder = new ClientConfigBuilder()
120120
.add({
121121
packages: { "wrap://ens/mock.polywrap.eth": mockPlugin() },
122122
})
123-
.addDefaults()
124-
.build();
123+
.addDefaults();
125124

126-
const client = new PolywrapClient(config);
125+
const client = new PolywrapClient(builder.build());
127126

128127
const clientResult = await client.invoke({
129128
uri: wrapperUri.uri,

packages/config-bundles/sys/src/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Common from "./common";
22

33
import { Bundle } from "@polywrap/config-bundle-types-js";
4-
import Node from "@polywrap/sys-node-config-bundle-js";
4+
import * as Node from "@polywrap/sys-node-config-bundle-js";
55

66
export const bundle: Bundle = {
77
...Common.bundle,

packages/manifests/wrap/scripts/templates/validate-ts.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515

1616
import Ajv, { Schema } from "ajv";
1717

18-
const ajv = new Ajv();
18+
const ajv = new Ajv({ strict: false });
1919

2020
type WrapManifestSchemas = {
2121
[key in WrapManifestVersions]: Schema | undefined

packages/manifests/wrap/src/formats/wrap.info/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313

1414
import Ajv, { Schema } from "ajv";
1515

16-
const ajv = new Ajv();
16+
const ajv = new Ajv({ strict: false });
1717

1818
type WrapManifestSchemas = {
1919
[key in WrapManifestVersions]: Schema | undefined

0 commit comments

Comments
 (0)