How to use the graphql-playground-middleware-express.default.mockReturnValueOnce function in graphql-playground-middleware-express

To help you get started, we’ve selected a few graphql-playground-middleware-express 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 Jordaneisenburger / fallback-studio / src / pwa-studio / packages / pwa-buildpack / lib / WebpackTools / __tests__ / PWADevServer.spec.js View on Github external
test('graphql-playground middleware handles error during project query read', async () => {
    const config = mockConfig();

    fs.readFile.mockImplementation((p, opts, cb) =>
        cb(new Error(`ENOENT: ${p} not found`))
    );

    const middleware = jest.fn();
    playgroundMiddleware.mockReturnValueOnce(middleware);

    await PWADevServer.configure({ graphqlPlayground: true }, config);

    expect(config.devServer.before).toBeInstanceOf(Function);
    const app = {
        get: jest.fn(),
        use: jest.fn()
    };
    const compilerStatsData = {
        stats: [
            {
                compilation: {
                    fileDependencies: new Set([
                        'path/to/module.js',
                        'path/to/query.graphql',
                        'path/to/otherModule.js',

graphql-playground-middleware-express

GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis