-
Notifications
You must be signed in to change notification settings - Fork 86
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 #143 from yahoo/testing
Refactor Fetchr Tests
- Loading branch information
Showing
15 changed files
with
586 additions
and
680 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright 2016, Yahoo! Inc. | ||
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. | ||
*/ | ||
var DEFAULT_XHR_PATH = '/api'; | ||
|
||
var express = require('express'); | ||
var bodyParser = require('body-parser'); | ||
var app = express(); | ||
|
||
var FetcherServer = require('../../libs/fetcher'); | ||
var mockService = require('./MockService'); | ||
var mockErrorService = require('./MockErrorService'); | ||
FetcherServer.registerService(mockService); | ||
FetcherServer.registerService(mockErrorService); | ||
|
||
app.use(bodyParser.json()); | ||
app.use(DEFAULT_XHR_PATH, FetcherServer.middleware()); | ||
|
||
module.exports = app; | ||
module.exports.DEFAULT_XHR_PATH = DEFAULT_XHR_PATH; |
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,28 @@ | ||
/** | ||
* Copyright 2016, Yahoo! Inc. | ||
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. | ||
*/ | ||
var express = require('express'); | ||
var bodyParser = require('body-parser'); | ||
var app = express(); | ||
|
||
var FetcherServer = require('../../libs/fetcher'); | ||
var mockService = require('./MockService'); | ||
var mockErrorService = require('./MockErrorService'); | ||
FetcherServer.registerService(mockService); | ||
FetcherServer.registerService(mockErrorService); | ||
|
||
app.use(bodyParser.json()); | ||
app.use(function cors (req, res, next) { | ||
if (req.query.cors) { | ||
res.set('Access-Control-Allow-Origin', '*'); | ||
next(); | ||
} else { | ||
res.sendStatus(403); | ||
} | ||
}); | ||
app.use(FetcherServer.middleware()); | ||
|
||
var CORS_PORT = 3001; | ||
module.exports = app.listen(CORS_PORT); | ||
module.exports.corsPath = 'http://localhost:' + CORS_PORT; |
Oops, something went wrong.