Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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',