Skip to content

Commit

Permalink
Removed Cloudflare from test suite; it is down again.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 4, 2020
1 parent cafd344 commit 17dc022
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 49 deletions.
92 changes: 46 additions & 46 deletions packages/tests/src.ts/test-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,57 +41,57 @@ function equals(name: string, actual: any, expected: any): void {
assert.equal(actual, expected, 'value matches - ' + name);
}

function TestContractEvents() {
return ethers.utils.fetchJson('https://api.ethers.io/api/v1/?action=triggerTest&address=' + contract.address).then(function(data) {
console.log(' *** Triggered Transaction Hash: ' + data.hash);

contract.on("error", (error) => {
console.log(error);
assert(false);
contract.removeAllListeners();
});

function waitForEvent(eventName: string, expected: Array<any>): Promise<void> {
return new Promise(function(resolve, reject) {
let done = false;
contract.on(eventName, function() {
if (done) { return; }
done = true;

let args = Array.prototype.slice.call(arguments);
let event = args[args.length - 1];
event.removeListener();
equals(event.event, args.slice(0, args.length - 1), expected);
resolve();
});
async function TestContractEvents() {
const data = await ethers.utils.fetchJson('https://api.ethers.io/api/v1/?action=triggerTest&address=' + contract.address);

const timer = setTimeout(() => {
if (done) { return; }
done = true;
console.log(' *** Triggered Transaction Hash: ' + data.hash);

contract.removeAllListeners();
reject(new Error("timeout"));
}, TIMEOUT_PERIOD);
if (timer.unref) { timer.unref(); }
});
}
contract.on("error", (error) => {
console.log(error);
assert(false);
contract.removeAllListeners();
});

function waitForEvent(eventName: string, expected: Array<any>): Promise<void> {
return new Promise(function(resolve, reject) {
let p0 = '0x06B5955A67D827CDF91823E3bB8F069e6c89c1D6';
let p0_1 = '0x06b5955A67d827CdF91823e3Bb8F069e6C89C1d7';
let p1 = 0x42;
let p1_1 = 0x43;

return Promise.all([
waitForEvent('Test', [ p0, p1 ]),
waitForEvent('TestP0', [ p0, p1 ]),
waitForEvent('TestP0P1', [ p0, p1 ]),
waitForEvent('TestIndexedString', [ { indexed: true, hash: '0x7c5ea36004851c764c44143b1dcb59679b11c9a68e5f41497f6cf3d480715331' }, p1 ]),
waitForEvent('TestV2', [ { indexed: true }, [ p0, p1 ] ]),
waitForEvent('TestV2Nested', [ { indexed: true }, [ p0_1, p1_1, [ p0, p1 ] ] ]),
]).then(function(result) {
let done = false;
contract.on(eventName, function() {
if (done) { return; }
done = true;

let args = Array.prototype.slice.call(arguments);
let event = args[args.length - 1];
event.removeListener();
equals(event.event, args.slice(0, args.length - 1), expected);
resolve();
});

const timer = setTimeout(() => {
if (done) { return; }
done = true;

contract.removeAllListeners();
reject(new Error("timeout"));
}, TIMEOUT_PERIOD);
if (timer.unref) { timer.unref(); }
});
}

return new Promise(function(resolve, reject) {
let p0 = '0x06B5955A67D827CDF91823E3bB8F069e6c89c1D6';
let p0_1 = '0x06b5955A67d827CdF91823e3Bb8F069e6C89C1d7';
let p1 = 0x42;
let p1_1 = 0x43;

return Promise.all([
waitForEvent('Test', [ p0, p1 ]),
waitForEvent('TestP0', [ p0, p1 ]),
waitForEvent('TestP0P1', [ p0, p1 ]),
waitForEvent('TestIndexedString', [ { indexed: true, hash: '0x7c5ea36004851c764c44143b1dcb59679b11c9a68e5f41497f6cf3d480715331' }, p1 ]),
waitForEvent('TestV2', [ { indexed: true }, [ p0, p1 ] ]),
waitForEvent('TestV2Nested', [ { indexed: true }, [ p0_1, p1_1, [ p0, p1 ] ] ]),
]).then(function(result) {
resolve();
});
});
}
Expand All @@ -116,7 +116,7 @@ describe('Test Contract Objects', function() {

let seq = Promise.resolve();
[
[p0, p1, [ p0, p1 ] ],
[ p0, p1, [ p0, p1 ] ],
{ p0: p0, p1: p1, child: [ p0, p1 ] },
[ p0, p1, { p0: p0, p1: p1 } ],
{ p0: p0, p1: p1, child: { p0: p0, p1: p1 } }
Expand Down
4 changes: 1 addition & 3 deletions packages/tests/src.ts/test-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,7 @@ function testProvider(providerName: string, networkName: string) {
["default", "homestead", "ropsten", "rinkeby", "kovan", "goerli"].forEach(function(networkName) {
["getDefaultProvider", "AlchemyProvider", "CloudflareProvider", "InfuraProvider", "EtherscanProvider", "NodesmithProvider", "Web3Provider"].forEach(function(providerName) {
if (providerName === "NodesmithProvider") { return; }

// Cloudflare seems down and I want a fix out. RicMoo
//if (providerName === "CloudflareProvider") { return; }
if (providerName === "CloudflareProvider") { return; }

if (networkName === "goerli" && providerName === "AlchemyProvider") { return; }
if ((networkName !== "homestead" && networkName !== "default") && providerName === "CloudflareProvider") { return; }
Expand Down

0 comments on commit 17dc022

Please sign in to comment.