diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts index fcc870af6..da28b97a3 100644 --- a/hapi/hapi-tests.ts +++ b/hapi/hapi-tests.ts @@ -5,6 +5,26 @@ import Hapi = require('hapi'); // Create a server with a host and port var server = Hapi.createServer('localhost', 8000); +// Add plugins +var plugin: any = { + register: function (plugin: Object, options: Object, next: Function) { + next(); + } +}; + +plugin.register.attributes = { + name: 'test', + version: '1.0.0' +}; + +server.pack.register(plugin, (err: Object) => { + if (err) { throw err; } +}); + +server.pack.register([plugin], (err: Object) => { + if (err) { throw err; } +}); + // Add the route server.route({ method: 'GET', diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 6276c8765..09453737a 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -103,6 +103,7 @@ declare module Hapi { export class Pack { require(name: string, options: {}, callback: Function): void; + register(plugins: any, options?: Object, callback?: Function, state?: Object): void; } export interface ServerView {