Skip to content

Commit c055eeb

Browse files
committed
use built lib in e2e tests and cast expected return to Uint8Array bytes
1 parent 420c696 commit c055eeb

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

test/e2e/src/bindings.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
generateFundedKeypair,
1010
installContract,
1111
} from "./util.js";
12-
import { Address, contract } from "../../../src/index.js";
12+
import { Address, contract } from "../../../lib/esm/index.js";
1313

1414
const CLI_PATH = path.resolve(__dirname, "../../../bin/stellar-js");
1515

@@ -331,12 +331,12 @@ describe("Generated Bindings E2E Test", () => {
331331
// Test bytes method
332332
const bytesInput = Buffer.from("hello");
333333
const bytesResult = await client.bytes({ bytes: bytesInput });
334-
expect(bytesResult.result).toEqual(bytesInput);
334+
expect(bytesResult.result).toEqual(Uint8Array.from(bytesInput));
335335

336336
// Test bytes_n method
337337
const bytesNInput = Buffer.from("123456789");
338338
const bytesNResult = await client.bytes_n({ bytes_n: bytesNInput });
339-
expect(bytesNResult.result).toEqual(bytesNInput);
339+
expect(bytesNResult.result).toEqual(Uint8Array.from(bytesNInput));
340340

341341
// Test card method
342342
const cardResult = await client.card({ card: 11 });

test/e2e/src/constructor-args.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect, beforeAll, describe, it } from "vitest";
2-
import { contract } from "../../../lib/esm/index.js";
2+
import { contract } from "../../../src/index.js";
33
import { installContract, rpcUrl, networkPassphrase } from "./util.js";
4-
import { basicNodeSigner } from "../../../lib/esm/contract/index.js";
4+
import { basicNodeSigner } from "../../../src/contract/index.js";
55

66
const INIT_VALUE = 42;
77

test/e2e/src/custom-types.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, beforeAll, describe, it } from "vitest";
2-
import { Address, contract } from "../../../src/index.js";
2+
import { Address, contract } from "../../../lib/esm/index.js";
33
import { clientFor } from "./util.js";
44

55
let context: {
@@ -177,13 +177,15 @@ describe("Custom Types Tests", () => {
177177

178178
it("bytes", async () => {
179179
const bytes = Buffer.from("hello");
180-
expect((await context.client.bytes({ bytes })).result).toEqual(bytes);
180+
expect((await context.client.bytes({ bytes })).result).toEqual(
181+
Uint8Array.from(bytes),
182+
);
181183
});
182184

183185
it("bytesN", async () => {
184186
const bytesN = Buffer.from("123456789"); // what's the correct way to construct bytesN?
185187
expect((await context.client.bytes_n({ bytes_n: bytesN })).result).toEqual(
186-
bytesN,
188+
Uint8Array.from(bytesN),
187189
);
188190
});
189191

test/e2e/src/swap.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, describe, it, beforeAll } from "vitest";
2-
import { contract, rpc } from "../../../src/index.js";
2+
import { contract, rpc } from "../../../lib/esm/index.js";
33
import { clientFor, generateFundedKeypair } from "./util.js";
44

55
const amountAToSwap = 2n;

test/e2e/src/util.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { spawnSync } from "node:child_process";
22
import path from "node:path";
3-
import { contract, Keypair, rpc } from "../../../src/index.js";
3+
import { contract, Keypair, rpc } from "../../../lib/esm/index.js";
44

55
/*
66
* Run a Bash command, returning stdout, stderr, and status code.
@@ -110,10 +110,12 @@ const installContract = async (
110110
const internalKeypair = keypair ?? (await generateFundedKeypair());
111111

112112
let wasmHash = contracts[name].hash;
113+
console.log("in installContract, wasmHash:", wasmHash);
113114
if (!wasmHash) {
114115
wasmHash = run(
115116
`${stellar} contract upload --wasm ${contracts[name].path}`,
116117
).stdout;
118+
console.log("wasm hash didn't exist, so uploaded and got:", wasmHash);
117119
}
118120
return { keypair: internalKeypair, wasmHash };
119121
};
@@ -143,7 +145,7 @@ const clientFor = async (
143145
const { wasmHash } = await installContract(name, {
144146
keypair: internalKeypair,
145147
});
146-
148+
console.log(`wasmHash for ${name}: ${wasmHash} <========`);
147149
const deploy = await contract.Client.deploy(
148150
(contracts[name] as any).constructorArgs ?? null,
149151
{

0 commit comments

Comments
 (0)