const test = require('tape');
const User = require('../../../models/User');
const { connect, add } = require('../../database');

test('connection to database', async (assert) => {
  const res = await connect();
  assert.equal(res, 0, 'It should connect to the database without errors');
  assert.end();
});

test('adding to database', async (assert) => {
  const res = await add(User, 'sample', 'secret');
  assert.equal(res, 0, 'It should add documents to the database without errors');
  assert.end();
});

@@ -473,32 +473,352 @@
 thout errors');%0A
+  // await remove(User, 'sample');%0A  assert.end();%0A%7D);%0A%0Atest('adding duplicates to database', async (assert) =%3E %7B%0A  await add(User, 'sample', 'secret');%0A  const res = await add(User, 'sample', 'secret');%0A  assert.equal(res, 1, 'It should not add duplicate documents to the database');%0A  // await remove(User, 'sample');%0A
   assert.end();%0A

Test for adding duplicates to database