mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 08:35:49 +00:00
add tests to linting
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"node": true
|
"node": true,
|
||||||
|
"mocha": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended"
|
"eslint:recommended"
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"prepublish": "npm run clean && npm run compile && npm run build",
|
"prepublish": "npm run clean && npm run compile && npm run build",
|
||||||
"test": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha --exit",
|
"test": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha --exit",
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts 'test/*-test.{ts,js}'",
|
||||||
"perf": "./scripts/perf_test.sh",
|
"perf": "./scripts/perf_test.sh",
|
||||||
"start": "node scripts/http.js"
|
"start": "node scripts/http.js"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -147,17 +147,17 @@ describe('RippleAPI', function () {
|
|||||||
|
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
this.api.xrpToDrops('.')
|
this.api.xrpToDrops('.')
|
||||||
}, /xrpToDrops\: invalid value '\.', should be a BigNumber or string-encoded number\./)
|
}, /xrpToDrops: invalid value '\.', should be a BigNumber or string-encoded number\./)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws with an amount more than one decimal point', function () {
|
it('throws with an amount more than one decimal point', function () {
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
this.api.xrpToDrops('1.0.0')
|
this.api.xrpToDrops('1.0.0')
|
||||||
}, /xrpToDrops:\ invalid\ value\ '1\.0\.0'\,\ should\ be\ a\ number\ matching\ \(\^\-\?\[0\-9\]\*\.\?\[0\-9\]\*\$\)\./)
|
}, /xrpToDrops: invalid value '1\.0\.0', should be a number matching \(\^-\?\[0-9\]\*\.\?\[0-9\]\*\$\)\./)
|
||||||
|
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
this.api.xrpToDrops('...')
|
this.api.xrpToDrops('...')
|
||||||
}, /xrpToDrops:\ invalid\ value\ '\.\.\.'\,\ should\ be\ a\ number\ matching\ \(\^\-\?\[0\-9\]\*\.\?\[0\-9\]\*\$\)\./)
|
}, /xrpToDrops: invalid value '\.\.\.', should be a number matching \(\^-\?\[0-9\]\*\.\?\[0-9\]\*\$\)\./)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -261,17 +261,17 @@ describe('RippleAPI', function () {
|
|||||||
|
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
this.api.dropsToXrp('.')
|
this.api.dropsToXrp('.')
|
||||||
}, /dropsToXrp\: invalid value '\.', should be a BigNumber or string-encoded number\./)
|
}, /dropsToXrp: invalid value '\.', should be a BigNumber or string-encoded number\./)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws with an amount more than one decimal point', function () {
|
it('throws with an amount more than one decimal point', function () {
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
this.api.dropsToXrp('1.0.0')
|
this.api.dropsToXrp('1.0.0')
|
||||||
}, /dropsToXrp:\ invalid\ value\ '1\.0\.0'\,\ should\ be\ a\ number\ matching\ \(\^\-\?\[0\-9\]\*\.\?\[0\-9\]\*\$\)\./)
|
}, /dropsToXrp: invalid value '1\.0\.0', should be a number matching \(\^-\?\[0-9\]\*\.\?\[0-9\]\*\$\)\./)
|
||||||
|
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
this.api.dropsToXrp('...')
|
this.api.dropsToXrp('...')
|
||||||
}, /dropsToXrp:\ invalid\ value\ '\.\.\.'\,\ should\ be\ a\ number\ matching\ \(\^\-\?\[0\-9\]\*\.\?\[0\-9\]\*\$\)\./)
|
}, /dropsToXrp: invalid value '\.\.\.', should be a number matching \(\^-\?\[0-9\]\*\.\?\[0-9\]\*\$\)\./)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ describe('RippleAPI', function () {
|
|||||||
it('throws with an invalid secret', function (){
|
it('throws with an invalid secret', function (){
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
this.api.deriveKeypair('...');
|
this.api.deriveKeypair('...');
|
||||||
}, /^Error\: Non\-base58 character$/)
|
}, /^Error: Non-base58 character$/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1364,7 +1364,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects promise and does not throw when field is missing', function (done) {
|
it('rejects promise and does not throw when field is missing', function (done) {
|
||||||
@@ -1393,7 +1393,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects promise and does not throw when fee exceeds maxFeeXRP', function (done) {
|
it('rejects promise and does not throw when fee exceeds maxFeeXRP', function (done) {
|
||||||
@@ -1427,7 +1427,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preparePayment - XRP to XRP no partial', function (done) {
|
it('preparePayment - XRP to XRP no partial', function (done) {
|
||||||
@@ -1442,7 +1442,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preparePayment - address must match payment.source.address', function (done) {
|
it('preparePayment - address must match payment.source.address', function (done) {
|
||||||
@@ -1457,7 +1457,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preparePayment - wrong amount', function (done) {
|
it('preparePayment - wrong amount', function (done) {
|
||||||
@@ -1472,7 +1472,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preparePayment - throws when fee exceeds 2 XRP', function (done) {
|
it('preparePayment - throws when fee exceeds 2 XRP', function (done) {
|
||||||
@@ -1492,7 +1492,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1593,7 +1593,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareOrderCancellation', function () {
|
it('prepareOrderCancellation', function () {
|
||||||
@@ -1632,7 +1632,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareTrustline - simple', function () {
|
it('prepareTrustline - simple', function () {
|
||||||
@@ -1667,7 +1667,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareSettings', function () {
|
it('prepareSettings', function () {
|
||||||
@@ -1764,7 +1764,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareSettings - signers no weights', function () {
|
it('prepareSettings - signers no weights', function () {
|
||||||
@@ -1820,7 +1820,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareEscrowCreation', function () {
|
it('prepareEscrowCreation', function () {
|
||||||
@@ -1855,7 +1855,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareEscrowExecution', function () {
|
it('prepareEscrowExecution', function () {
|
||||||
@@ -1888,7 +1888,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareEscrowExecution - no fulfillment', function (done) {
|
it('prepareEscrowExecution - no fulfillment', function (done) {
|
||||||
@@ -1903,7 +1903,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prepareEscrowCancellation', function () {
|
it('prepareEscrowCancellation', function () {
|
||||||
@@ -2507,7 +2507,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects Promise on preparePaymentChannelClaim with no signature', function (done) {
|
it('rejects Promise on preparePaymentChannelClaim with no signature', function (done) {
|
||||||
@@ -2522,7 +2522,7 @@ describe('RippleAPI', function () {
|
|||||||
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
}).catch(done); // Finish test with assertion failure immediately instead of waiting for timeout.
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
done(new Error('Expected method to reject, but method threw. Thrown: ' + err));
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sign', function () {
|
it('sign', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user