Skip to content

Commit

Permalink
Added foobar.html test
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Mar 28, 2018
1 parent 39d0443 commit 18bd277
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/static.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function genericErrorResponseChecks (t, response) {
}

t.test('register /static', t => {
t.plan(9)
t.plan(10)

const pluginOptions = {
root: path.join(__dirname, '/static'),
Expand Down Expand Up @@ -144,6 +144,18 @@ t.test('register /static', t => {
genericErrorResponseChecks(t, response)
})
})

t.test('file not exposed outside of the plugin', t => {
t.plan(2)
request.get({
method: 'GET',
// foobar is in static
uri: 'http://localhost:' + fastify.server.address().port + '/foobar.html'
}, (err, response, body) => {
t.error(err)
t.strictEqual(response.statusCode, 404)
})
})
})
})

Expand Down
3 changes: 3 additions & 0 deletions test/static/foobar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<html>
<body>foobar</body>
</html>

0 comments on commit 18bd277

Please sign in to comment.