Skip to content

Commit

Permalink
tests created for folderAssets function
Browse files Browse the repository at this point in the history
relates #8
  • Loading branch information
samjam48 committed Jul 31, 2019
1 parent ddea531 commit 0e2e256
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const fs = require('fs');

const folderContents = () => {

};

module.exports = {
folderContents,
};
14 changes: 14 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const test = require('tape');
const supertest = require('supertest');
const router = require('../src/router.js');
const utils = require('../src/utils.js');

test('check home status code is 200', (t) => {
supertest(router)
Expand Down Expand Up @@ -34,3 +35,16 @@ test('check home app.js status code is 200', (t) => {
t.end(err);
});
});

test('Check that assetsContents function is a pure function that returns array of objects', (t) => {
const folder = '../tests';
const folderCheck = folder;
const actual = utils.folderContents(folder);
const expected = [{
name: 'tests.js',
filepath: '/Users/samjam/Code/founders-and-coders/course/5-node-advanced/make-notes-project/tests/test.js',
}];
t.deepEqual(actual, expected, 'returns array of correct objects');
t.deepEqual(folder, folderCheck, 'does not mutate arguments passed to it');
t.deepEqual(actual, expected, 'returns same result given same arguments');
});

0 comments on commit 0e2e256

Please sign in to comment.