Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekn committed Jan 31, 2017
1 parent c89bb96 commit 1c12a12
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/integration/server_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ describe("integration tests", function () {
this.timeout(TIMEOUT);
this.slow(TIMEOUT/2);

StellarSdk.Network.useTestNetwork();

// Docker
let server = new StellarSdk.Server('http://127.0.0.1:8000', {allowHttp: true});
//let server = new StellarSdk.Server('http://192.168.59.103:32773', {allowHttp: true});
Expand All @@ -15,7 +17,7 @@ describe("integration tests", function () {
});

function checkConnection(done) {
server.loadAccount(master.accountId())
server.loadAccount(master.publicKey())
.then(source => {
console.log('Horizon up and running!');
done();
Expand All @@ -27,7 +29,7 @@ describe("integration tests", function () {
}

function createNewAccount(accountId) {
return server.loadAccount(master.accountId())
return server.loadAccount(master.publicKey())
.then(source => {
let tx = new StellarSdk.TransactionBuilder(source)
.addOperation(StellarSdk.Operation.createAccount({
Expand All @@ -44,7 +46,7 @@ describe("integration tests", function () {

describe("/transaction", function () {
it("submits a new transaction", function (done) {
createNewAccount(StellarSdk.Keypair.random().accountId())
createNewAccount(StellarSdk.Keypair.random().publicKey())
.then(result => {
expect(result.ledger).to.be.not.null;
done();
Expand All @@ -53,12 +55,12 @@ describe("integration tests", function () {
});

it("submits a new transaction with error", function (done) {
server.loadAccount(master.accountId())
server.loadAccount(master.publicKey())
.then(source => {
source.incrementSequenceNumber(); // This will cause an error
let tx = new StellarSdk.TransactionBuilder(source)
.addOperation(StellarSdk.Operation.createAccount({
destination: StellarSdk.Keypair.random().accountId(),
destination: StellarSdk.Keypair.random().publicKey(),
startingBalance: "20"
}))
.build();
Expand All @@ -81,7 +83,7 @@ describe("integration tests", function () {
.call()
.then(accounts => {
// The first account should be a master account
expect(accounts.records[0].account_id).to.equal(master.accountId());
expect(accounts.records[0].account_id).to.equal(master.publicKey());
done();
});
});
Expand All @@ -94,12 +96,12 @@ describe("integration tests", function () {
.cursor('now')
.stream({
onmessage: account => {
expect(account.account_id).to.equal(randomAccount.accountId());
expect(account.account_id).to.equal(randomAccount.publicKey());
done();
}
});

createNewAccount(randomAccount.accountId());
createNewAccount(randomAccount.publicKey());
setTimeout(() => eventStreamClose(), 10*1000);
});
});
Expand Down

0 comments on commit 1c12a12

Please sign in to comment.