From 59193779ba2860708e05b7db6751718d3b946efe Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Tue, 23 Aug 2016 16:28:53 +1000 Subject: Tests for all other coins / networks --- tests.js | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 218 insertions(+), 2 deletions(-) diff --git a/tests.js b/tests.js index 7a3a842..352f225 100644 --- a/tests.js +++ b/tests.js @@ -165,7 +165,7 @@ page.open(url, function(status) { // Network can be set to bitcoin testnet function() { page.open(url, function(status) { - // set the phrase and passphrase + // set the phrase and coin var expected = "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi"; page.evaluate(function() { $(".phrase").val("abandon abandon ability"); @@ -190,15 +190,231 @@ page.open(url, function(status) { }); }, -// TODO finish these tests // Network can be set to litecoin +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "LQ4XU8RX2ULPmPq9FcUHdVmPVchP9nwXdn"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=2]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("Litecoin address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + // Network can be set to dogecoin +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "DPQH2AtuzkVSG6ovjKk4jbUmZ6iXLpgbJA"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=3]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("Dogecoin address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + // Network can be set to shadowcash +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "SiSZtfYAXEFvMm3XM8hmtkGDyViRwErtCG"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=4]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("Shadowcash address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + // Network can be set to shadowcash testnet +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=5]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("Shadowcash testnet address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + // Network can be set to viacoin +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=6]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("Viacoin address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + // Network can be set to viacoin testnet +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=7]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("Viacoin testnet address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + // Network can be set to jumbucks +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "JLEXccwDXADK4RxBPkRez7mqsHVoJBEUew"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=8]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("Jumbucks address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + // Network can be set to clam +function() { +page.open(url, function(status) { + // set the phrase and coin + var expected = "xCp4sakjVx4pUAZ6cBCtuin8Ddb6U1sk9y"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + $(".network option[selected]").removeAttr("selected"); + $(".network option[value=9]").prop("selected", true); + $(".network").trigger("change"); + }); + // check the address is generated correctly + setTimeout(function() { + var actual = page.evaluate(function() { + return $(".address:first").text(); + }); + if (actual != expected) { + console.log("CLAM address is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }, 1000); +}); +}, + +// TODO finish these tests // BIP39 seed is set from phrase // BIP32 root key is set from phrase -- cgit v1.2.3