Skip to content

Commit 494de59

Browse files
authored
Creating a new testing structure (#13)
* Creating a new testing structure This diff does a couple things: - It creates test file for every Model and Document method that we'll need to handle and test. These can be gradually filled in. - It breaks helpers.js functions into separate files. Each one of those now has a corresponding test file. In upcoming diffs, I'll move the existing tests into this new structure. * fixing lint issue
1 parent 1654573 commit 494de59

50 files changed

Lines changed: 370 additions & 215 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

__tests__/authIsDisabled.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Create tests for authIsDisabled');

__tests__/cleanAuthLevels.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const test = require('ava');
2+
const mongoose = require('mongoose');
3+
// const cleanAuthLevels = require('../src/cleanAuthLevels');
4+
5+
test.before((t) => {
6+
t.context.schema = new mongoose.Schema({ friend: String });
7+
});
8+
9+
test.todo('Schema passed in is not valid');
10+
test.todo('Falsey authLevel value');
11+
test.todo('Empty array authLevel value');
12+
test.todo('Remove duplicate entries');
13+
test.todo('Remove false entries');
14+
test.todo('Remove entries that are not in the permissions object');
15+
test.todo('authLevel with no issues');
16+

__tests__/embedPermissions.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Migrate tests for embedPermissions');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Migrate tests for getAuthorizedFields');

__tests__/getUpdatePaths.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Migrate getUpdatePaths tests to this file');

__tests__/hasPermission.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Migrate hasPermission tests here');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Write tests for Document.save');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Write tests for Document.update');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Write tests for Model.aggregate. It should be a disabled method');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test = require('ava');
2+
3+
test.todo('Write tests for Model.bulkWrite. It should be disabled, does not support middleware');

0 commit comments

Comments
 (0)