Created
February 26, 2017 07:43
-
-
Save yutin1987/0c4b5489bfc4cd80b88ad1238f84e641 to your computer and use it in GitHub Desktop.
mock knex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import knex from 'knex'; | |
export const query = jest.fn(() => Promise.resolve([])); | |
const client = class extends knex.Client { | |
_query = query; | |
acquireConnection = () => Promise.resolve({}); | |
processResponse = resp => resp; | |
releaseConnection = () => Promise.resolve(); | |
}; | |
export default () => knex({ client }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment