-
Notifications
You must be signed in to change notification settings - Fork 52
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 #322 from pactumjs/321-read-json-file-from-nested-…
…folders-with-file-name feat: find file in withJson
- Loading branch information
Showing
10 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
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,51 @@ | ||
const { spec, settings } = require('../../src/index'); | ||
|
||
describe('withJson', () => { | ||
|
||
before(() => { | ||
settings.setDataDirectory('test/data'); | ||
}); | ||
|
||
after(() => { | ||
settings.setDataDirectory('data'); | ||
}); | ||
|
||
it('with file in parent folder', async () => { | ||
await spec() | ||
.useInteraction({ | ||
request: { | ||
method: 'POST', | ||
path: '/file', | ||
body: { | ||
"key": "value-1" | ||
} | ||
}, | ||
response: { | ||
status: 200 | ||
} | ||
}) | ||
.post('http://localhost:9393/file') | ||
.withJson('sample-1.json') | ||
.expectStatus(200); | ||
}); | ||
|
||
it('with file in child folder', async () => { | ||
await spec() | ||
.useInteraction({ | ||
request: { | ||
method: 'POST', | ||
path: '/file', | ||
body: { | ||
"key": "value-2" | ||
} | ||
}, | ||
response: { | ||
status: 200 | ||
} | ||
}) | ||
.post('http://localhost:9393/file') | ||
.withJson('sample-2.json') | ||
.expectStatus(200); | ||
}); | ||
|
||
}); |
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,3 @@ | ||
{ | ||
"key": "value-2" | ||
} |
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,3 @@ | ||
{ | ||
"key": "value-1" | ||
} |