aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-report
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sra-report')
-rw-r--r--packages/sra-report/CHANGELOG.json3
-rw-r--r--packages/sra-report/CHANGELOG.md6
-rw-r--r--packages/sra-report/package.json19
-rw-r--r--packages/sra-report/src/index.ts13
-rw-r--r--packages/sra-report/src/postman_environment_factory.ts19
-rw-r--r--packages/sra-report/test/test_runner.ts11
6 files changed, 48 insertions, 23 deletions
diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json
index 90a807c85..015279157 100644
--- a/packages/sra-report/CHANGELOG.json
+++ b/packages/sra-report/CHANGELOG.json
@@ -6,7 +6,8 @@
"note": "Properly export the executable binary",
"pr": 588
}
- ]
+ ],
+ "timestamp": 1527009133
},
{
"timestamp": 1525477860,
diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md
index e390e76ef..208a1e174 100644
--- a/packages/sra-report/CHANGELOG.md
+++ b/packages/sra-report/CHANGELOG.md
@@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
-## v0.0.14 - _May 5, 2018_
+## v0.1.0 - _May 22, 2018_
+
+ * Properly export the executable binary (#588)
+
+## v0.0.14 - _May 4, 2018_
* Dependencies updated
diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json
index 9622acd2e..810acab1c 100644
--- a/packages/sra-report/package.json
+++ b/packages/sra-report/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/sra-report",
- "version": "0.0.14",
+ "version": "0.1.0",
"engines": {
"node": ">=6.12"
},
@@ -31,20 +31,21 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md",
"dependencies": {
- "0x.js": "^0.37.2",
- "@0xproject/assert": "^0.2.9",
- "@0xproject/connect": "^0.6.12",
- "@0xproject/json-schemas": "^0.7.23",
- "@0xproject/typescript-typings": "^0.3.1",
- "@0xproject/utils": "^0.6.1",
+ "@0xproject/assert": "^0.2.10",
+ "@0xproject/types": "^0.7.0",
+ "@0xproject/order-utils": "^0.0.5",
+ "@0xproject/connect": "^0.6.13",
+ "@0xproject/json-schemas": "^0.7.24",
+ "@0xproject/typescript-typings": "^0.3.2",
+ "@0xproject/utils": "^0.6.2",
"chalk": "^2.3.0",
"lodash": "^4.17.4",
"newman": "^3.9.3",
"yargs": "^10.0.3"
},
"devDependencies": {
- "@0xproject/monorepo-scripts": "^0.1.19",
- "@0xproject/tslint-config": "^0.4.17",
+ "@0xproject/monorepo-scripts": "^0.1.20",
+ "@0xproject/tslint-config": "^0.4.18",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.48",
"@types/nock": "^9.1.2",
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts
index 9a203b654..3b72ad44e 100644
--- a/packages/sra-report/src/index.ts
+++ b/packages/sra-report/src/index.ts
@@ -13,7 +13,18 @@ import { postmanEnvironmentFactory } from './postman_environment_factory';
import { utils } from './utils';
const DEFAULT_NETWORK_ID = 1;
-const SUPPORTED_NETWORK_IDS = [1, 3, 4, 42];
+const networkNameToId: { [networkName: string]: number } = {
+ mainnet: 1,
+ ropsten: 3,
+ rinkeby: 4,
+ kovan: 42,
+};
+const SUPPORTED_NETWORK_IDS = [
+ networkNameToId.mainnet,
+ networkNameToId.ropsten,
+ networkNameToId.rinkeby,
+ networkNameToId.kovan,
+];
// extract command line arguments
const args = yargs
diff --git a/packages/sra-report/src/postman_environment_factory.ts b/packages/sra-report/src/postman_environment_factory.ts
index 42389aea2..f8fe02d72 100644
--- a/packages/sra-report/src/postman_environment_factory.ts
+++ b/packages/sra-report/src/postman_environment_factory.ts
@@ -1,6 +1,7 @@
-import { SignedOrder, ZeroEx } from '0x.js';
import { HttpClient } from '@0xproject/connect';
import { Schema, schemas as schemasByName } from '@0xproject/json-schemas';
+import { getOrderHashHex } from '@0xproject/order-utils';
+import { SignedOrder } from '@0xproject/types';
import { logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import * as _ from 'lodash';
@@ -11,6 +12,12 @@ import { addresses as rinkebyAddresses } from './contract_addresses/rinkeby_addr
import { addresses as ropstenAddresses } from './contract_addresses/ropsten_addresses';
const ENVIRONMENT_NAME = 'SRA Report';
+const networkNameToId: { [networkName: string]: number } = {
+ mainnet: 1,
+ ropsten: 3,
+ rinkeby: 4,
+ kovan: 42,
+};
export interface EnvironmentValue {
key: string;
@@ -92,7 +99,7 @@ async function createOrderEnvironmentValuesAsync(url: string): Promise<Environme
createEnvironmentValue('orderMaker', orderIfExists.maker),
createEnvironmentValue('orderTaker', orderIfExists.taker),
createEnvironmentValue('orderFeeRecipient', orderIfExists.feeRecipient),
- createEnvironmentValue('orderHash', ZeroEx.getOrderHashHex(orderIfExists)),
+ createEnvironmentValue('orderHash', getOrderHashHex(orderIfExists)),
];
} else {
logUtils.log(`${chalk.red(`No orders from /orders found`)}`);
@@ -107,13 +114,13 @@ async function createOrderEnvironmentValuesAsync(url: string): Promise<Environme
}
function getContractAddresses(networkId: number): Addresses {
switch (networkId) {
- case 1:
+ case networkNameToId.mainnet:
return mainnetAddresses;
- case 3:
+ case networkNameToId.ropsten:
return ropstenAddresses;
- case 4:
+ case networkNameToId.rinkeby:
return rinkebyAddresses;
- case 42:
+ case networkNameToId.kovan:
return kovanAddresses;
default:
throw new Error('Unsupported network id');
diff --git a/packages/sra-report/test/test_runner.ts b/packages/sra-report/test/test_runner.ts
index 5ea3cdc4d..fe238e98a 100644
--- a/packages/sra-report/test/test_runner.ts
+++ b/packages/sra-report/test/test_runner.ts
@@ -24,6 +24,7 @@ const expect = chai.expect;
const CONTENT_TYPE_ASSERTION_NAME = 'Has Content-Type header with value application/json';
const SCHEMA_ASSERTION_NAME = 'Schema is valid';
+const SUCCESS_STATUS = 200;
const baseNewmanRunOptions = {
collection: sraReportCollectionJSON,
environment: postmanEnvironmentJSON,
@@ -46,7 +47,7 @@ export const testRunner = {
};
describe(CONTENT_TYPE_ASSERTION_NAME, () => {
it('fails when there are no headers', async () => {
- nockInterceptor.reply(200, {});
+ nockInterceptor.reply(SUCCESS_STATUS, {});
const summary = await utils.newmanRunAsync(newmanRunOptions);
const error = findAssertionErrorIfExists(
summary,
@@ -61,7 +62,7 @@ export const testRunner = {
const headers = {
'Content-Type': 'text/html',
};
- nockInterceptor.reply(200, {}, headers);
+ nockInterceptor.reply(SUCCESS_STATUS, {}, headers);
const summary = await utils.newmanRunAsync(newmanRunOptions);
const error = findAssertionErrorIfExists(
summary,
@@ -76,7 +77,7 @@ export const testRunner = {
const headers = {
'Content-Type': 'charset=utf-8; application/json',
};
- nockInterceptor.reply(200, {}, headers);
+ nockInterceptor.reply(SUCCESS_STATUS, {}, headers);
const summary = await utils.newmanRunAsync(newmanRunOptions);
const error = findAssertionErrorIfExists(
summary,
@@ -100,7 +101,7 @@ export const testRunner = {
};
describe(SCHEMA_ASSERTION_NAME, () => {
it('fails when schema is invalid', async () => {
- nockInterceptor.reply(200, malformedJson);
+ nockInterceptor.reply(SUCCESS_STATUS, malformedJson);
const summary = await utils.newmanRunAsync(newmanRunOptions);
const error = findAssertionErrorIfExists(summary, postmanCollectionRequestName, SCHEMA_ASSERTION_NAME);
const errorMessage = _.get(error, 'message');
@@ -108,7 +109,7 @@ export const testRunner = {
expect(errorMessage).to.equal('expected false to be true');
});
it('passes when schema is valid', async () => {
- nockInterceptor.reply(200, correctJson);
+ nockInterceptor.reply(SUCCESS_STATUS, correctJson);
const summary = await utils.newmanRunAsync(newmanRunOptions);
const error = findAssertionErrorIfExists(summary, postmanCollectionRequestName, SCHEMA_ASSERTION_NAME);
const errorMessage = _.get(error, 'message');