const { KnexAdapter } = require('../lib/adapter-knex');

// const mockError = jest.spyOn(global.console, 'error');
// const mockWarn = jest.spyOn(global.console, 'warn');

global.console = {
  error: jest.fn(),
  warn: jest.fn(),
  log: jest.fn(),
};

describe('Knex Adapter', () => {
  const testAdapter = new KnexAdapter();
  test('throws when database cannot be found', async () => {
    const result = await testAdapter
      ._connect({ name: 'undefined-database' })
      .catch(result => result);
    expect(global.console.error).toHaveBeenCalledWith(
      "Could not connect to database: 'postgres://localhost/undefined_database'"
    );
    expect(result).toBeInstanceOf(Error);
  });
});

@@ -54,123 +54,8 @@
 );%0A%0A
-// const mockError = jest.spyOn(global.console, 'error');%0A// const mockWarn = jest.spyOn(global.console, 'warn');%0A%0A
 glob

tidy up