diff --git a/test/e2e/src/test-contract-client-constructor.js b/test/e2e/src/test-contract-client-constructor.js index 67bc02e54..79479ba6c 100644 --- a/test/e2e/src/test-contract-client-constructor.js +++ b/test/e2e/src/test-contract-client-constructor.js @@ -100,7 +100,7 @@ describe("Client", function () { it("can be constructed with `new Client`", async function() { const { result } = await this.context.client.hello({ to: "tests" }); - expect(result).to.equal("tests"); + expect(result).to.deep.equal(["Hello", "tests"]); }); it("can be constructed with `from`", async function () { diff --git a/test/e2e/src/test-custom-types.js b/test/e2e/src/test-custom-types.js index ef23c01a9..14ecfdce6 100644 --- a/test/e2e/src/test-custom-types.js +++ b/test/e2e/src/test-custom-types.js @@ -17,19 +17,42 @@ describe("Custom Types Tests", function () { }); it("view method with empty keypair", async function() { - const { client: client2 } = await clientFor("helloWorld", { + const { client: client2 } = await clientFor("customTypes", { keypair: undefined, - contractId: this.context.contractId, + contractId: this.context.contractId }); - expect((await client2.hello({ hello: "anonymous" })).result).to.equal( - "anonymous", - ); + expect((await client2.i32_({ i32_: 1 })).result).to.equal(1); + }); + + it("should increment the counter correctly", async function() { + const { result: startingBalance } = await this.context.client.get_count(); + const inc = await this.context.client.inc(); + const incrementResponse = await inc.signAndSend(); + expect(incrementResponse.result).to.equal(startingBalance + 1); + expect(startingBalance).to.equal(0); // Assuming the counter starts at 0 + const { result: newBalance } = await this.context.client.get_count(); + expect(newBalance).to.equal(startingBalance + 1); + }); + + it("should accept only options object for methods with no arguments", async function() { + const inc = await this.context.client.inc({ simulate: false }); + expect(inc.simulation).to.be.undefined; }); it("woid", async function () { expect((await this.context.client.woid()).result).to.be.null; }); + it("should authenticate the user correctly", async function() { + const { result } = await this.context.client.auth({ addr: this.context.publicKey, world: "lol" }); + expect(result).to.equal(this.context.publicKey); + }); + + it("should authenticate the user correctly", async function() { + const { result } = await this.context.client.auth({ addr: this.context.publicKey, world: "lol" }); + expect(result).to.equal(this.context.publicKey); + }); + it("u32_fail_on_even", async function () { let response = await this.context.client.u32_fail_on_even({ u32_: 1 }); expect(response.result).to.deep.equal(new contract.Ok(1)); diff --git a/test/e2e/src/test-hello-world.js b/test/e2e/src/test-hello-world.js deleted file mode 100644 index ac74a4629..000000000 --- a/test/e2e/src/test-hello-world.js +++ /dev/null @@ -1,34 +0,0 @@ -const { expect } = require("chai"); -const { clientFor } = require("./util"); - -describe("helloWorld client", function () { - it("should return properly formed hello response", async function () { - const { client } = await clientFor("helloWorld"); - const response = await client.hello({ world: "tests" }); - expect(response.result).to.deep.equal(["Hello", "tests"]); - }); - - it("should authenticate the user correctly", async function () { - const { client, keypair } = await clientFor("helloWorld"); - const publicKey = keypair.publicKey(); - const { result } = await client.auth({ addr: publicKey, world: "lol" }); - expect(result).to.equal(publicKey); - }); - - it("should increment the counter correctly", async function () { - const { client } = await clientFor("helloWorld"); - const { result: startingBalance } = await client.get_count(); - const inc = await client.inc(); - const incrementResponse = await inc.signAndSend(); - expect(incrementResponse.result).to.equal(startingBalance + 1); - expect(startingBalance).to.equal(0); // Assuming the counter starts at 0 - const { result: newBalance } = await client.get_count(); - expect(newBalance).to.equal(startingBalance + 1); - }); - - it("should accept only options object for methods with no arguments", async function () { - const { client } = await clientFor("helloWorld"); - const inc = await client.inc({ simulate: false }); - expect(inc.simulation).to.be.undefined; - }); -}); diff --git a/test/e2e/src/test-methods-as-args.js b/test/e2e/src/test-methods-as-args.js index 3308e907d..97cf096c8 100644 --- a/test/e2e/src/test-methods-as-args.js +++ b/test/e2e/src/test-methods-as-args.js @@ -9,7 +9,7 @@ function callMethod(method, args) { describe("methods-as-args", function () { it("should pass methods as arguments and have them still work", async function () { const { client } = await clientFor("helloWorld"); - const { result } = await callMethod(client.hello, { world: "tests" }); + const { result } = await callMethod(client.hello, { to: "tests" }); expect(result).to.deep.equal(["Hello", "tests"]); }); }); diff --git a/test/e2e/src/util.js b/test/e2e/src/util.js index 43d94ec56..81a865ce2 100644 --- a/test/e2e/src/util.js +++ b/test/e2e/src/util.js @@ -84,7 +84,7 @@ module.exports.friendbotUrl = friendbotUrl; async function generateFundedKeypair() { const keypair = Keypair.random(); - await fetch(`${friendbotUrl}/?addr=${keypair.publicKey()}`); + await fetch(friendbotUrl.indexOf('friendbot.stellar.org') !== -1 ? `${friendbotUrl}/?addr=${keypair.publicKey()}` : `${friendbotUrl}/friendbot?addr=${keypair.publicKey()}`); return keypair; } module.exports.generateFundedKeypair = generateFundedKeypair;