-
Notifications
You must be signed in to change notification settings - Fork 5
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 #179 from curveball/some-unittests
Added a basic unittest.
- Loading branch information
Showing
7 changed files
with
44 additions
and
10 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Application } from '@curveball/kernel'; | ||
import browser from '../src/index.js'; | ||
import { expect } from 'chai'; | ||
|
||
describe('Browser middleware integration test', () => { | ||
|
||
it('should render a HTML page when an `Accept` header with text/html is emitted', async() => { | ||
|
||
const app = new Application(); | ||
const mw = browser(); | ||
app.use(mw); | ||
|
||
app.use( ctx => { | ||
ctx.response.body = { hello: 'world' }; | ||
ctx.response.type = 'application/json'; | ||
}); | ||
|
||
const resp = await app.subRequest('GET', '/', { | ||
Accept: 'text/html' | ||
}); | ||
|
||
expect(resp.status).to.equal(200); | ||
expect(resp.is('html')).to.equal(true); | ||
expect(resp.body).to.contain('<html><head>'); | ||
|
||
}); | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.