-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apis: intercept api call and alter the response with test data (dummy…
… json data extracted from file)
- Loading branch information
1 parent
d3a609b
commit 5e406b7
Showing
3 changed files
with
70 additions
and
7 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
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,8 @@ | ||
import fs from "fs"; | ||
|
||
function extractArticlesTestDataFrom(testDataJSONFilePath): Object { | ||
const testDataJSONString = fs.readFileSync(testDataJSONFilePath, "utf8"); | ||
return JSON.parse(testDataJSONString); | ||
} | ||
|
||
export default {extractArticlesTestDataFrom}; |
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,31 @@ | ||
{ | ||
"articles": [ | ||
{ | ||
"slug":"slug-of-the-intercepted-articles-endpoint", | ||
"title": "title of the intercepted articles endpoint", | ||
"description": "description of the intercepted articles endpoint", | ||
"body": "body of the intercepted articles endpoint", | ||
"author": { | ||
"username": "author: intercepted by ash karai" | ||
} | ||
}, | ||
{ | ||
"slug":"slug-of-the-intercepted-articles-endpoint", | ||
"title": "title of the intercepted articles endpoint", | ||
"description": "description of the intercepted articles endpoint", | ||
"body": "body of the intercepted articles endpoint", | ||
"author": { | ||
"username": "author: intercepted by ash karai" | ||
} | ||
}, | ||
{ | ||
"slug":"slug-of-the-intercepted-articles-endpoint", | ||
"title": "title of the intercepted articles endpoint", | ||
"description": "description of the intercepted articles endpoint", | ||
"body": "body of the intercepted articles endpoint", | ||
"author": { | ||
"username": "author: intercepted by ash karai" | ||
} | ||
} | ||
] | ||
} |