aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-report/test/postman_collection_v0_test.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-20 19:52:22 +0800
committerFabio Berger <me@fabioberger.com>2018-03-20 19:52:22 +0800
commit2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5 (patch)
tree60d846e22cf80416f0dd43ead8dd494c5735152f /packages/sra-report/test/postman_collection_v0_test.ts
parent5468358f2142549c68ffae0085ce7d31ea271ea4 (diff)
parent7d9c357409c25996f9c448dffd69007f69b9d8d6 (diff)
downloaddexon-sol-tools-2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5.tar
dexon-sol-tools-2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5.tar.gz
dexon-sol-tools-2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5.tar.bz2
dexon-sol-tools-2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5.tar.lz
dexon-sol-tools-2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5.tar.xz
dexon-sol-tools-2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5.tar.zst
dexon-sol-tools-2f7c19e80d31cbcc09c6e87841682e8f35f0ecd5.zip
Merge branch 'development' into addExtraDocs
* development: (29 commits) Set Lodash dep to an exact version since newer versions introduced breaking changes Update Kovan Ethertoken Address Update deployer version since manual re-publish Add new entry into CHANGELOG Fix bad merge Update yarn.lock Change title Add Blake and Zach to About page Re-size Jacob and Tom's images Manually publish 0x.js back to a working state Publish Publish Fix 0x.js assets Remove assets from connect and _bundles from packages that don't generate the folder Publish Fix packages that aren't working as expected Make new packages default to public on publish Add new public packages to top-level README Update top-level package.json Fix incorrect new versions ... # Conflicts: # packages/0x.js/package.json # packages/connect/package.json # packages/json-schemas/package.json # packages/sol-cov/package.json
Diffstat (limited to 'packages/sra-report/test/postman_collection_v0_test.ts')
-rw-r--r--packages/sra-report/test/postman_collection_v0_test.ts76
1 files changed, 76 insertions, 0 deletions
diff --git a/packages/sra-report/test/postman_collection_v0_test.ts b/packages/sra-report/test/postman_collection_v0_test.ts
new file mode 100644
index 000000000..dfb16b10d
--- /dev/null
+++ b/packages/sra-report/test/postman_collection_v0_test.ts
@@ -0,0 +1,76 @@
+import 'mocha';
+import * as nock from 'nock';
+
+import * as defaultRequestTokenPairsResponseJSON from './fixtures/v0/token_pairs/default_request.json';
+import * as malformedTokenPairsResponseJSON from './fixtures/v0/token_pairs/malformed.json';
+import * as tokenAAndTokenBParamsTokenPairsResponseJSON from './fixtures/v0/token_pairs/token_a_and_token_b_params.json';
+import * as tokenAParamTokenPairsResponseJSON from './fixtures/v0/token_pairs/token_a_param.json';
+import * as tokenBParamTokenPairsResponseJSON from './fixtures/v0/token_pairs/token_b_param.json';
+import { testRunner } from './test_runner';
+
+describe('Postman Collection v0', () => {
+ const testRelayerUrl = 'https://example.com';
+ const nockScope = nock(testRelayerUrl);
+ afterEach(() => {
+ nock.cleanAll();
+ });
+ describe('GET /token_pairs', () => {
+ const postmanCollectionFolderName = 'GET /token_pairs';
+ const resourcePath = '/token_pairs';
+ describe('default request', () => {
+ const postmanCollectionRequestName = 'default request';
+ const nockInterceptor = nockScope.get(resourcePath);
+ testRunner.runContentTypeTests(nockInterceptor, postmanCollectionFolderName, postmanCollectionRequestName);
+ testRunner.runSchemaTests(
+ nockInterceptor,
+ postmanCollectionFolderName,
+ postmanCollectionRequestName,
+ malformedTokenPairsResponseJSON,
+ defaultRequestTokenPairsResponseJSON,
+ );
+ });
+ describe('tokenA param', () => {
+ const postmanCollectionRequestName = 'tokenA param';
+ const nockInterceptor = nockScope.get(resourcePath).query({
+ tokenA: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ });
+ testRunner.runContentTypeTests(nockInterceptor, postmanCollectionFolderName, postmanCollectionRequestName);
+ testRunner.runSchemaTests(
+ nockInterceptor,
+ postmanCollectionFolderName,
+ postmanCollectionRequestName,
+ malformedTokenPairsResponseJSON,
+ tokenAParamTokenPairsResponseJSON,
+ );
+ });
+ describe('tokenB param', () => {
+ const postmanCollectionRequestName = 'tokenB param';
+ const nockInterceptor = nockScope.get(resourcePath).query({
+ tokenB: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ });
+ testRunner.runContentTypeTests(nockInterceptor, postmanCollectionFolderName, postmanCollectionRequestName);
+ testRunner.runSchemaTests(
+ nockInterceptor,
+ postmanCollectionFolderName,
+ postmanCollectionRequestName,
+ malformedTokenPairsResponseJSON,
+ tokenBParamTokenPairsResponseJSON,
+ );
+ });
+ describe('tokenA and tokenB params', () => {
+ const postmanCollectionRequestName = 'tokenA and tokenB params';
+ const nockInterceptor = nockScope.get(resourcePath).query({
+ tokenA: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ tokenB: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ });
+ testRunner.runContentTypeTests(nockInterceptor, postmanCollectionFolderName, postmanCollectionRequestName);
+ testRunner.runSchemaTests(
+ nockInterceptor,
+ postmanCollectionFolderName,
+ postmanCollectionRequestName,
+ malformedTokenPairsResponseJSON,
+ tokenAAndTokenBParamsTokenPairsResponseJSON,
+ );
+ });
+ });
+});