-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing coffee-script and porting the fixture code to es6 (#25)
- Loading branch information
Showing
26 changed files
with
141 additions
and
491 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 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,6 @@ | ||
module.exports = function () { | ||
return this.properties({ | ||
Port: 9088, | ||
RootWebPath: '/user/agustin/test/' | ||
}); | ||
} |
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,12 @@ | ||
module.exports = function (BaseController) { | ||
|
||
class MockController extends BaseController { | ||
configure(app) { | ||
super.configure(app); | ||
app.get("/", (req, res) => { res.status(200).send("SomeIndex") }); | ||
app.get("/with-error", (req, res) => { throw new Error("Throwing a basic error") }); | ||
} | ||
} | ||
|
||
return new MockController(); | ||
} |
26 changes: 0 additions & 26 deletions
26
test/fixtures/controllers/PromiseMiddlewareTestController.coffee
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
test/fixtures/controllers/PromiseMiddlewareTestController.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,36 @@ | ||
module.exports = function (BaseController, Promise) { | ||
|
||
class PromiseMiddlewareTestController extends BaseController { | ||
|
||
configure(app) { | ||
super.configure(app); | ||
app.get('/promise-middleware-test--jsonasync', this.getJsonAsync); | ||
app.get('/promise-middleware-test--renderasync', this.getRenderAsync); | ||
app.get('/promise-middleware-test--sendAsync', this.getSendAsync); | ||
app.get('/promise-middleware-test--sendStatusAsync', this.getSendStatusAsync); | ||
app.get('/promise-middleware-test--formatAsync', this.getFormatAsync); | ||
} | ||
|
||
getJsonAsync(req, res) { | ||
res.jsonAsync(Promise.resolve('jsonAsync success')); | ||
} | ||
|
||
getRenderAsync(req, res) { | ||
res.renderAsync('renderView', Promise.resolve({ microapp: 'renderAsync success' })); | ||
} | ||
|
||
getSendAsync(req, res) { | ||
res.sendAsync(Promise.resolve('sendAsync success')); | ||
} | ||
|
||
getSendStatusAsync(req, res) { | ||
res.sendStatusAsync(Promise.resolve({ status: 200 })); | ||
} | ||
|
||
getFormatAsync(req, res) { | ||
res.formatAsync(Promise.resolve('formatAsync success')); | ||
} | ||
} | ||
|
||
return new PromiseMiddlewareTestController(); | ||
}; |
18 changes: 0 additions & 18 deletions
18
test/fixtures/controllers/ServerErrorTestController.coffee
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,25 @@ | ||
module.exports = function (BaseController, SpurErrors) { | ||
|
||
class ServerErrorTestController extends BaseController { | ||
configure(app) { | ||
super.configure(app); | ||
app.get('/500-error-test', this.getErrorTest.bind(this)); | ||
app.get('/500-standard-error-test', this.getStandardErrorTest.bind(this)); | ||
app.get('/404-error-test', this.getNotFoundErrorTest.bind(this)); | ||
} | ||
|
||
getErrorTest(req, res) { | ||
throw SpurErrors.InternalServerError.create('Some dumb server error'); | ||
} | ||
|
||
getStandardErrorTest(req, res) { | ||
throw 'Some dumb server error'; | ||
} | ||
|
||
getNotFoundErrorTest() { | ||
throw SpurErrors.NotFoundError.create('Some dumb not found error'); | ||
} | ||
} | ||
|
||
return new ServerErrorTestController(); | ||
}; |
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,28 @@ | ||
const path = require('path'); | ||
const spur = require('spur-ioc'); | ||
const spurCommon = require('spur-common'); | ||
const localInjector = require('../../src/injector'); | ||
const registerConfig = require('spur-common/registerConfig'); | ||
const colors = require('colors'); | ||
|
||
module.exports = function () { | ||
|
||
const ioc = spur.create('test-spur-web'); | ||
|
||
registerConfig(ioc, path.join(__dirname, 'config')); | ||
|
||
ioc.merge(spurCommon()); | ||
ioc.merge(localInjector()); | ||
|
||
ioc.registerFolders(__dirname, [ | ||
'controllers/', | ||
'middleware/', | ||
'runtime/' | ||
]); | ||
|
||
ioc.registerDependencies({ | ||
colors: colors | ||
}); | ||
|
||
return ioc; | ||
}; |
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,12 @@ | ||
module.exports = function (BaseMiddleware, Logger) { | ||
|
||
class TestBaseMiddleware extends BaseMiddleware { | ||
|
||
configure() { | ||
super.configure(); | ||
Logger.log('Subclass called'); | ||
} | ||
} | ||
|
||
return new TestBaseMiddleware(); | ||
}; |
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,19 @@ | ||
module.exports = function (BaseWebServer, Logger, path) { | ||
|
||
class TestWebServer extends BaseWebServer { | ||
|
||
registerDefaultMiddleware(){ | ||
super.registerDefaultMiddleware(); | ||
this.registerEjsTemplates(); | ||
} | ||
|
||
registerEjsTemplates() { | ||
Logger.log('EJS Template Registration'); | ||
|
||
this.app.set('view engine', 'ejs'); | ||
this.app.set('views', path.join(__dirname, '../views')); | ||
} | ||
} | ||
|
||
return new TestWebServer(); | ||
} |
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.
Oops, something went wrong.