mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-12 21:52:42 +00:00
Setting up search tests
This commit is contained in:
@@ -11,7 +11,7 @@ const AdminSearch = React.createClass({
|
||||
},
|
||||
render: function(){
|
||||
return <div className='adminSearch'>
|
||||
AdminSearch Component Ready.
|
||||
<h1>Admin Search</h1>
|
||||
</div>
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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']);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user