-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8aa686f
commit 9f6ac4a
Showing
3 changed files
with
25 additions
and
0 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,13 @@ | ||
const tap = require('tap'); | ||
const hapiconfi = require('../index.js'); | ||
const Hapi = require('@hapi/hapi'); | ||
|
||
tap.test('test server is initialized ', async () => { | ||
const { server, config } = await hapiconfi(Hapi, { configPath: `${__dirname}/conf` }); | ||
const schema1 = require('./schema1.js'); | ||
const schema2 = require('./schema2.js'); | ||
await schema1.validate({ email: 'nowhere@nowhere.com' }); | ||
await schema2.validate({ email: 'nowhere@nowhere.com' }); | ||
await server.start(); | ||
await server.stop(); | ||
}); |
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 @@ | ||
const Joi = require('@hapi/joi'); | ||
|
||
module.exports = Joi.object({ | ||
email: Joi.string().email().required(), | ||
createdOn: Joi.date().forbidden().default(Date.now) | ||
}); |
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 @@ | ||
const Joi = require('@hapi/joi'); | ||
|
||
module.exports = Joi.object({ | ||
email: Joi.string().email().required(), | ||
createdOn: Joi.date().forbidden().default(Date.now) | ||
}); |