Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagonal committed Mar 24, 2020
1 parent 8aa686f commit 9f6ac4a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/schema-test.js
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();
});
6 changes: 6 additions & 0 deletions test/schema1.js
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)
});
6 changes: 6 additions & 0 deletions test/schema2.js
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)
});

0 comments on commit 9f6ac4a

Please sign in to comment.