-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from jordanwalsh23/fix/error_with_no_path
Fix/error with no path
- Loading branch information
Showing
5 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"info": { | ||
"_postman_id": "39a1d6e2-8a17-436b-886c-f87c3b2f1248", | ||
"name": "Test Request with No Path", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | ||
"_exporter_id": "18475687" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "No Path", | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "{{baseUrl}}", | ||
"host": [ | ||
"{{baseUrl}}" | ||
] | ||
} | ||
}, | ||
"response": [ | ||
{ | ||
"name": "No Path", | ||
"originalRequest": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "{{baseUrl}}", | ||
"host": [ | ||
"{{baseUrl}}" | ||
] | ||
} | ||
}, | ||
"status": "OK", | ||
"code": 200, | ||
"_postman_previewlanguage": "json", | ||
"header": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json", | ||
"name": "Content-Type", | ||
"description": "", | ||
"type": "text" | ||
} | ||
], | ||
"cookie": [], | ||
"body": "{\n \"status\": \"OK\"\n}" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const fs = require('fs') | ||
const PostmanLocalMockServer = require('../index.js') | ||
const axios = require('axios').default | ||
const assert = require('assert') | ||
|
||
const PORT = 3561; | ||
|
||
var options = { | ||
port: PORT, | ||
debug: true | ||
} | ||
|
||
let server | ||
|
||
describe('Postman Local Mock Server Tests', () => { | ||
beforeEach(() => { | ||
options.collection = JSON.parse( | ||
fs.readFileSync('./test/collections/test-collection-no-path.json', 'utf8') | ||
) | ||
|
||
server = new PostmanLocalMockServer(options) | ||
server.start() | ||
}) | ||
|
||
describe('Get with no path', () => { | ||
it('Default GET response test with no path', async () => { | ||
return await axios.get(`http://localhost:${PORT}`).then(res => { | ||
assert(res.data.status === 'OK') | ||
}) | ||
}) | ||
}) | ||
|
||
afterEach(() => { | ||
server.stop() | ||
}) | ||
}); |