aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/schema_test.ts100
1 files changed, 47 insertions, 53 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts
index fb5aba321..29375e9e9 100644
--- a/test/schema_test.ts
+++ b/test/schema_test.ts
@@ -123,7 +123,7 @@ describe('Schema', () => {
validateAgainstSchema(testCases, tokenSchema, true);
});
});
- describe('#orderSchema', () => {
+ describe('order including schemas', () => {
const order = {
maker: constants.NULL_ADDRESS,
taker: constants.NULL_ADDRESS,
@@ -137,60 +137,54 @@ describe('Schema', () => {
feeRecipient: constants.NULL_ADDRESS,
expirationUnixTimestampSec: 42,
};
- it('should validate valid order', () => {
- const testCases = [
- order,
- ];
- validateAgainstSchema(testCases, orderSchema);
- });
- it('should fail for invalid order', () => {
- const testCases = [
- {
- ...order,
- salt: undefined,
- },
- {
- ...order,
- salt: 'salt',
- },
- 'order',
- ];
- validateAgainstSchema(testCases, orderSchema, true);
- });
- });
- describe('#signedOrderSchema', () => {
- const signedOrder = {
- maker: constants.NULL_ADDRESS,
- taker: constants.NULL_ADDRESS,
- makerFee: 1,
- takerFee: 2,
- makerTokenAmount: 1,
- takerTokenAmount: 2,
- makerTokenAddress: constants.NULL_ADDRESS,
- takerTokenAddress: constants.NULL_ADDRESS,
- salt: 256,
- feeRecipient: constants.NULL_ADDRESS,
- expirationUnixTimestampSec: 42,
- ecSignature: {
- v: 27,
- r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
- s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
- },
- };
- it('should validate valid order', () => {
- const testCases = [
- signedOrder,
- ];
- validateAgainstSchema(testCases, orderSchema);
+ describe('#orderSchema', () => {
+ it('should validate valid order', () => {
+ const testCases = [
+ order,
+ ];
+ validateAgainstSchema(testCases, orderSchema);
+ });
+ it('should fail for invalid order', () => {
+ const testCases = [
+ {
+ ...order,
+ salt: undefined,
+ },
+ {
+ ...order,
+ salt: 'salt',
+ },
+ 'order',
+ ];
+ validateAgainstSchema(testCases, orderSchema, true);
+ });
});
- it('should fail for invalid order', () => {
- const testCases = [
- {
- ...signedOrder,
- ecSignature: undefined,
+ describe('signed order including schemas', () => {
+ const signedOrder = {
+ ...order,
+ ecSignature: {
+ v: 27,
+ r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
+ s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
},
- ];
- validateAgainstSchema(testCases, orderSchema, true);
+ };
+ describe('#signedOrderSchema', () => {
+ it('should validate valid order', () => {
+ const testCases = [
+ signedOrder,
+ ];
+ validateAgainstSchema(testCases, orderSchema);
+ });
+ it('should fail for invalid order', () => {
+ const testCases = [
+ {
+ ...signedOrder,
+ ecSignature: undefined,
+ },
+ ];
+ validateAgainstSchema(testCases, orderSchema, true);
+ });
+ });
});
});
describe('BigNumber serialization', () => {