Skip to content

Commit b6bee65

Browse files
committed
chore: fix client tests
1 parent 4eabdc5 commit b6bee65

File tree

8 files changed

+54
-20
lines changed

8 files changed

+54
-20
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe("Error structure", () => {
9292
expect(prev.reason).toContain(
9393
"A URI Resolver returned an error."
9494
);
95-
expect(prev.uri).toEqual("wrapscan.io/polywrap/ens-uri-resolver@1.0.0");
95+
expect(prev.uri).toEqual("wrap://embed/http-uri-resolver@1.0.0");
9696
});
9797

9898
describe("Wasm wrapper - Assemblyscript", () => {

packages/client/src/__tests__/core/uri-resolution.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("URI resolution", () => {
3737
const result = await client.tryResolveUri({ uri, resolutionContext });
3838

3939
const expectResult = UriResolutionResult.ok(
40-
Uri.from("wrap://ipfs/QmSAXrSLcmGUkQRrApAtG5qTPmuRMMX2Zf1wihpguDQfbm")
40+
Uri.from("wrap://ipfs/QmeHyySwhkYvKqaPNtcq7wYDb1M9QnaqbaX1eDNDqW5fdt")
4141
);
4242

4343
if (expectResult.ok) {

packages/client/src/__tests__/core/wrap-features/interface-implementation-case.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
PolywrapClient,
55
UriMap,
66
} from "../../../index";
7-
import { PolywrapClientConfigBuilder } from "@polywrap/client-config-builder-js";
7+
import { PolywrapClientConfigBuilder, Sys } from "@polywrap/client-config-builder-js";
88
import { UriResolver } from "@polywrap/uri-resolvers-js";
99
import { mockPluginRegistration } from "../../helpers";
1010
import { GetPathToTestWrappers } from "@polywrap/test-cases";
@@ -269,6 +269,7 @@ export const interfaceInvokeCase = (implementation: string) => {
269269
.setRedirect(oldInterfaceUri.uri, newInterfaceUri.uri)
270270
.addInterfaceImplementation(oldInterfaceUri.uri, implementation1Uri.uri)
271271
.addInterfaceImplementation(newInterfaceUri.uri, implementation2Uri.uri)
272+
.setPackage(newInterfaceUri.uri, Sys.bundle.httpResolver.package!)
272273
.build();
273274

274275
const client = new PolywrapClient(config);

packages/client/src/__tests__/e2e.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { subinvokeCase } from "./core/wrap-features/subinvoke-case";
33
import { envTestCases } from "./core/wrap-features/env-case";
44
import { interfaceInvokeCase } from "./core/wrap-features/interface-implementation-case";
55

6+
jest.setTimeout(60000);
7+
68
export const supportedImplementations = ["as", "rs"];
9+
710
describe.each(supportedImplementations)(
811
"client <-> wrappers end to end",
912
(i) => {
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { IWrapPackage } from "@polywrap/core-js";
22

3-
export interface Bundle {
4-
[name: string]: {
5-
uri: string;
6-
package?: IWrapPackage;
7-
implements?: string[];
8-
redirectFrom?: string[];
9-
env?: {
10-
[prop: string]: unknown;
11-
};
3+
export interface BundlePackage {
4+
uri: string;
5+
package?: IWrapPackage;
6+
implements?: string[];
7+
redirectFrom?: string[];
8+
env?: {
9+
[prop: string]: unknown;
1210
};
1311
}
12+
13+
export interface Bundle {
14+
[name: string]: BundlePackage;
15+
}

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable */
22
import { IWrapPackage } from "@polywrap/core-js";
3-
import { Bundle } from "@polywrap/config-bundle-types-js";
3+
import { Bundle, BundlePackage } from "@polywrap/config-bundle-types-js";
44
import { ExtendableUriResolver } from "@polywrap/uri-resolver-extensions-js";
55

66
// $start: bundle
@@ -17,7 +17,19 @@ export const ipfsProviders: string[] = [
1717
"https://ipfs.io",
1818
];
1919

20-
export const bundle: Bundle = {
20+
export interface SysCommonBundle extends Bundle {
21+
logger: BundlePackage;
22+
datetime: BundlePackage;
23+
concurrent: BundlePackage;
24+
http: BundlePackage;
25+
githubResolver: BundlePackage;
26+
httpResolver: BundlePackage;
27+
wrapscanResolver: BundlePackage;
28+
ipfsHttpClient: BundlePackage;
29+
ipfsResolver: BundlePackage;
30+
}
31+
32+
export const bundle: SysCommonBundle = {
2133
logger: {
2234
uri: "plugin/logger@1.0.0",
2335
package: loggerPlugin({}) as IWrapPackage,

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
import * as Common from "./common";
33

44
import { IWrapPackage } from "@polywrap/core-js";
5-
import { Bundle } from "@polywrap/config-bundle-types-js";
5+
import { BundlePackage } from "@polywrap/config-bundle-types-js";
66
import { ExtendableUriResolver } from "@polywrap/uri-resolver-extensions-js";
77

88
// $start: bundle-node
99
import { fileSystemPlugin } from "@polywrap/file-system-plugin-js";
1010
import * as fileSystemResolver from "./embeds/file-system-resolver/wrap";
1111

12-
export const bundle: Bundle = {
12+
interface SysNodeBundle extends Common.SysCommonBundle {
13+
fileSystem: BundlePackage;
14+
fileSystemResolver: BundlePackage;
15+
}
16+
17+
export const bundle: SysNodeBundle = {
1318
...Common.bundle,
1419
fileSystem: {
1520
uri: "plugin/file-system@1.0",

packages/config-bundles/web3/src/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
/* eslint-disable */
22
import { IWrapPackage } from "@polywrap/core-js";
3-
import { Bundle } from "@polywrap/config-bundle-types-js";
3+
import { Bundle, BundlePackage } from "@polywrap/config-bundle-types-js";
44
import { ExtendableUriResolver } from "@polywrap/uri-resolver-extensions-js";
55

66
// $start: bundle
77
import * as Sys from "@polywrap/sys-config-bundle-js";
88
import * as EthWallet from "@polywrap/ethereum-wallet-js";
99

10-
export const bundle: Bundle = {
10+
export interface Web3Bundle extends Bundle {
11+
concurrent: BundlePackage;
12+
http: BundlePackage;
13+
ipfsHttpClient: BundlePackage;
14+
ipfsResolver: BundlePackage;
15+
ethereumWallet: BundlePackage;
16+
ensTextRecordResolver: BundlePackage;
17+
ensContenthashResolver: BundlePackage;
18+
ensIpfsContenthashResolver: BundlePackage;
19+
}
20+
21+
export const bundle: Web3Bundle = {
1122
concurrent: Sys.bundle.concurrent,
1223
http: Sys.bundle.http,
1324
ipfsHttpClient: Sys.bundle.ipfsHttpClient,
@@ -39,8 +50,8 @@ export const bundle: Bundle = {
3950
],
4051
redirectFrom: ["wrapscan.io/polywrap/ens-text-record-uri-resolver@1.0"],
4152
},
42-
ensResolver: {
43-
uri: "wrapscan.io/polywrap/ens-uri-resolver@1.0",
53+
ensContenthashResolver: {
54+
uri: "wrapscan.io/polywrap/ens-contenthash-uri-resolver@1.0",
4455
implements: [ExtendableUriResolver.defaultExtInterfaceUris[0].uri],
4556
},
4657
ensIpfsContenthashResolver: {

0 commit comments

Comments
 (0)