All files / db rethinkdbdash-instance.js

100% Statements 3/3
66.67% Branches 6/9
100% Functions 2/2
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30    1x             20x 1x                                      
// This file is only used for testing, will work with cirlceci in future
 
const r = require('rethinkdbdash')({
  db: "test",
  servers: [
    { host: '172.17.0.2', port: 28015 }
  ]
});
 
Iasync function freshUserTable() {
  console.log('freshUserTable');
 
  try {
    await r.tableDrop('users').run();
  } catch (err) {
    if (err.msg !== 'Table `test.users` does not exist')
      throw err;
  }
 
  try {
    await r.tableCreate('users').run();
  } catch (err) {
    if (err.msg !== 'Table `test.users` already exists.')
      throw err;
  }
}
 
export { freshUserTable };
export default r;