From dfcb04fd090cb712c31c5b888fd123126124a131 Mon Sep 17 00:00:00 2001 From: Scott Tolksdorf Date: Wed, 11 Jan 2017 13:41:07 -0500 Subject: [PATCH] Setting up search tests --- client/admin/adminSearch/adminSearch.jsx | 2 +- test/search.test.js | 69 ++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/client/admin/adminSearch/adminSearch.jsx b/client/admin/adminSearch/adminSearch.jsx index 1f95153be..15d09724c 100644 --- a/client/admin/adminSearch/adminSearch.jsx +++ b/client/admin/adminSearch/adminSearch.jsx @@ -11,7 +11,7 @@ const AdminSearch = React.createClass({ }, render: function(){ return
- AdminSearch Component Ready. +

Admin Search

} }); diff --git a/test/search.test.js b/test/search.test.js index e69de29bb..c4ab4e0ba 100644 --- a/test/search.test.js +++ b/test/search.test.js @@ -0,0 +1,69 @@ +const testing = require('./test.init.js'); +const _ = require('lodash'); + +const DB = require('db.js'); +const BrewData = require('brew.data.js'); +const Error = require('error.js'); + +const ids = (brewIds) => { + return _.map(brewIds, (brewId) => { + return { editId : brews[brewId].editId }; + }); +} + +const brews = { + BrewA : { + title : 'BrewA', + description : 'fancy', + authors : [], + systems : [] + }, + BrewB : { + title : 'BrewB', + description : 'fancy', + authors : [], + systems : [] + }, + BrewC : { + title : 'BrewC', + description : 'test', + authors : [], + systems : [] + }, + BrewD : { + title : 'BrewD', + description : 'test', + authors : [], + systems : [] + } +}; + +describe('Brew Search', () => { + before('Connect DB', DB.connect); + before('Clear DB', BrewData.removeAll); + before('Populate brews', ()=>{ + return Promise.all(_.map(brews, (brewData, id) => { + return BrewData.create(brewData) + .then((brew)=>{ brews[id] = brew; }); + })); + }); + + it('should find brews based on title and/or description', () => { + + return new Promise((resolve, reject) => { + return reject() + }) + .catch(()=>{ console.log('here1');}) + .catch(()=>{ console.log('here2');}) + + return BrewData.create({ + text : 'Brew Text' + }).then((brew) => { + +}); + //result.count.should.be.equal(2) + //result.brews.should.deep.include.members(ids(['BrewA', 'BrewB']); + }); + + +}); \ No newline at end of file