Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. const config = require('config');
  2.  
  3. const knexConfig = config.get('knexConfig');
  4.  
  5. module.exports = {
  6.  
  7. development: {
  8. client: knexConfig.client,
  9. connection: {
  10. host: knexConfig.host,
  11. database: knexConfig.database,
  12. user: knexConfig.user,
  13. password: knexConfig.password,
  14. },
  15. pool: {
  16. min: knexConfig.min,
  17. max: knexConfig.max,
  18. },
  19. },
  20. test: {
  21. client: 'sqlite3',
  22. connection: {
  23. filename: './file.db',
  24. },
  25. },
  26. };
  27.  
  28. process.env.NODE_ENV = 'test';
  29. const provider = require('../../../server/models/provider');
  30.  
  31.  
  32. describe('Should test provider Model', () => {
  33. test('should return provider', () => {
  34. provider
  35. .query()
  36. .then((providers) => {
  37. expect(providers).toBe('array');
  38. });
  39. });
  40. });
  41.  
  42. Unhandled rejection Error: no database connection available for a query. You need to bind the model class or the query to a knex instance.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement