How to use the @hapi/inert.plugin function in @hapi/inert

To help you get started, we’ve selected a few @hapi/inert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github academia-de-codigo / noire-server / test / plugins / docs.js View on Github external
it('handles inert plugin registration failures', async flags => {
        // cleanup
        const inertRegister = Inert.plugin.register;
        flags.onCleanup = function() {
            Inert.plugin.register = inertRegister;
        };

        // setup
        const PLUGIN_ERROR = 'plugin error';
        Inert.plugin.register = async function() {
            throw new Error(PLUGIN_ERROR);
        };
        const server = Hapi.server();

        // exercise and validate
        await expect(server.register(Docs)).to.reject(PLUGIN_ERROR);
    });
github academia-de-codigo / noire-server / test / plugins / docs.js View on Github external
it('handles inert plugin registration failures', async flags => {
        // cleanup
        const inertRegister = Inert.plugin.register;
        flags.onCleanup = function() {
            Inert.plugin.register = inertRegister;
        };

        // setup
        const PLUGIN_ERROR = 'plugin error';
        Inert.plugin.register = async function() {
            throw new Error(PLUGIN_ERROR);
        };
        const server = Hapi.server();

        // exercise and validate
        await expect(server.register(Docs)).to.reject(PLUGIN_ERROR);
    });

@hapi/inert

Static file and directory handlers plugin for hapi.js

BSD-3-Clause
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis

Popular @hapi/inert functions