-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "eslint" tool; Redefine mounting example
- Loading branch information
Showing
13 changed files
with
1,162 additions
and
172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
"extends": "airbnb-base", | ||
"env": { | ||
node: true, | ||
mocha: true | ||
}, | ||
"rules": { | ||
"max-len": "off", | ||
"func-names": "off", | ||
"no-useless-escape": "off", | ||
"global-require": "off", | ||
"import/no-dynamic-require": "off", | ||
"consistent-return": "off", | ||
"prefer-destructuring": "off", | ||
"camelcase": "off", | ||
"comma-dangle": ["error", "never"] | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
.nyc_output | ||
coverage* | ||
coverage* | ||
.idea |
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,12 @@ | ||
{ | ||
"exclude": [ | ||
"examples/**/*.js", | ||
"examples/**/*.json", | ||
"examples/**/*.xml", | ||
"test/mocks/**/*.js", | ||
"test/mocks/**/*.json", | ||
"test/mocks/**/*.xml", | ||
|
||
"test/**/*.spec.js" | ||
] | ||
} |
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,12 @@ | ||
const express = require('../../node_modules/express'); | ||
const apiMocker = require('../../index'); | ||
|
||
const app = express(); | ||
|
||
// default response | ||
app.use('/', apiMocker('states/base')); | ||
|
||
// definite state, where default response can be changed | ||
app.use('/', apiMocker('states/my-own-state')); | ||
|
||
app.listen(9090); |
14 changes: 14 additions & 0 deletions
14
examples/redefine-default-mounting/states/base/profile/GET.js
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,14 @@ | ||
module.exports = function (req, res, next) { | ||
next(); | ||
|
||
try { | ||
res.send({ | ||
profile: { | ||
first_name: 'Aaron', | ||
last_name: 'Pol' | ||
} | ||
}); | ||
} catch (e) { | ||
// | ||
} | ||
}; |
6 changes: 6 additions & 0 deletions
6
examples/redefine-default-mounting/states/my-own-state/profile/GET.json
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,6 @@ | ||
{ | ||
"profile": { | ||
"first_name": "Bryan", | ||
"last_name": "Cranston" | ||
} | ||
} |
Oops, something went wrong.