Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #55 from quorumcontrol/fix/integration-tests
Browse files Browse the repository at this point in the history
Use test helpers for wallet creation in ownership tests
  • Loading branch information
Wes Morgan authored May 17, 2019
2 parents 6d7bd4b + 6fe6f71 commit fbdab2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- setup_remote_docker

- run: |
docker create -v /src --name source alpine /bin/true
docker cp . source:/src
docker create -v /src/tupelo --name source alpine /bin/true
docker cp . source:/src/tupelo
# TODO: Figure out node.js caching here

Expand Down
1 change: 0 additions & 1 deletion test/data.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const helpers = require("./helpers");
const assert = require("assert");
const Tagged = require("cbor/lib/tagged");
const Tupelo = require("../lib/tupelo");
const itRequires = helpers.itRequires

describe("setting and retrieving data", function() {
Expand Down
42 changes: 6 additions & 36 deletions test/ownership.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
const assert = require("assert");
const Tupelo = require("../lib/tupelo");
const TUPELO_HOST = process.env.TUPELO_RPC_HOST || 'localhost:50051'
const helpers = require("./helpers");

// TODO: Remove the "oldResult" tests once resolveData support is released.

describe("ownership transfer", function () {
this.timeout(30000);

it("can export and import", async () => {
const alice = Tupelo.connect(TUPELO_HOST, {
walletName: "alice-test",
passPhrase: "test",
});
// TODO: clear RPC server state between tests automatically
await alice.register();
const {keyAddr: aliceKey,} = await alice.generateKey();
const {chainId,} = await alice.createChainTree(aliceKey);

const bob = Tupelo.connect(TUPELO_HOST, {
walletName: "bob-test",
passPhrase: "test",
});
// TODO: clear RPC server state between tests automatically
await bob.register();
const {keyAddr: bobKey,} = await bob.generateKey();
assert.strictEqual(bobKey.length, 42);

let {wallet: alice, walletKey: aliceKey, chainId: chainId} = await helpers.createWalletWithChain();
let {wallet: bob, walletKey: bobKey, chainId: bobChainId} = await helpers.createWalletWithChain();

let resp = await alice.setData(chainId, aliceKey, "path/to/here", "hi");
assert.notEqual(resp.tip, null);

Expand All @@ -41,22 +25,8 @@ describe("ownership transfer", function () {
});

it("can do a real transfer from alice to bob", async () => {
const alice = Tupelo.connect(TUPELO_HOST, {
walletName: "alice-test",
passPhrase: "test",
});
// TODO: clear RPC server state between tests automatically
// await alice.register();
const {keyAddr: aliceKey,} = await alice.generateKey();
let {chainId,} = await alice.createChainTree(aliceKey);

const bob = Tupelo.connect(TUPELO_HOST, {
walletName: "bob-test",
passPhrase: "test",
});
// TODO: clear RPC server state between tests automatically
// await bob.register();
const {keyAddr: bobKey,} = await bob.generateKey();
let {wallet: alice, walletKey: aliceKey, chainId: chainId} = await helpers.createWalletWithChain();
let {wallet: bob, walletKey: bobKey, chainId: bobChainId} = await helpers.createWalletWithChain();

for (let i = 0; i < 5; i++) {
const resp = await alice.setData(chainId, aliceKey, "path/to/" + i.toString(),
Expand Down

0 comments on commit fbdab2e

Please sign in to comment.