mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 13:02:45 +00:00
Stubbing out tests for searching
This commit is contained in:
@@ -93,7 +93,15 @@ const BrewData = {
|
|||||||
return BrewData.get({ editId });
|
return BrewData.get({ editId });
|
||||||
},
|
},
|
||||||
|
|
||||||
search : (query, req={}) => {
|
search : (query, pagniation, sorting, permissions) => {
|
||||||
|
|
||||||
|
|
||||||
|
//search with query, add in `published = false`
|
||||||
|
// filter out editId and text
|
||||||
|
|
||||||
|
//if admin, removed published=false, remove filtering editId
|
||||||
|
|
||||||
|
|
||||||
//defaults with page and count
|
//defaults with page and count
|
||||||
//returns a non-text version of brews
|
//returns a non-text version of brews
|
||||||
//assume sanatized ?
|
//assume sanatized ?
|
||||||
|
|||||||
@@ -16,25 +16,33 @@ const brews = {
|
|||||||
title : 'BrewA',
|
title : 'BrewA',
|
||||||
description : 'fancy',
|
description : 'fancy',
|
||||||
authors : [],
|
authors : [],
|
||||||
systems : []
|
systems : [],
|
||||||
|
views : 12,
|
||||||
|
published : true
|
||||||
},
|
},
|
||||||
BrewB : {
|
BrewB : {
|
||||||
title : 'BrewB',
|
title : 'BrewB',
|
||||||
description : 'fancy',
|
description : 'fancy',
|
||||||
authors : [],
|
authors : [],
|
||||||
systems : []
|
systems : [],
|
||||||
|
views : 7,
|
||||||
|
published : true
|
||||||
},
|
},
|
||||||
BrewC : {
|
BrewC : {
|
||||||
title : 'BrewC',
|
title : 'BrewC',
|
||||||
description : 'test',
|
description : 'test',
|
||||||
authors : [],
|
authors : [],
|
||||||
systems : []
|
systems : [],
|
||||||
|
views : 0,
|
||||||
|
published : false
|
||||||
},
|
},
|
||||||
BrewD : {
|
BrewD : {
|
||||||
title : 'BrewD',
|
title : 'BrewD',
|
||||||
description : 'test',
|
description : 'test',
|
||||||
authors : [],
|
authors : [],
|
||||||
systems : []
|
systems : [],
|
||||||
|
views : 1,
|
||||||
|
published : true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,21 +56,47 @@ describe('Brew Search', () => {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find brews based on title and/or description', () => {
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
describe('Searching', ()=>{
|
||||||
return reject()
|
it('should be able to search for all brews', ()=>{
|
||||||
})
|
|
||||||
.catch(()=>{ console.log('here1');})
|
|
||||||
.catch(()=>{ console.log('here2');})
|
|
||||||
|
|
||||||
return BrewData.create({
|
|
||||||
text : 'Brew Text'
|
|
||||||
}).then((brew) => {
|
|
||||||
|
|
||||||
});
|
});
|
||||||
//result.count.should.be.equal(2)
|
it('should find brews based on title and/or description', () => {
|
||||||
//result.brews.should.deep.include.members(ids(['BrewA', 'BrewB']);
|
|
||||||
|
//result.count.should.be.equal(2)
|
||||||
|
//result.brews.should.deep.include.members(ids(['BrewA', 'BrewB']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the total number of brews and page info for query', ()=>{
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Permissions', () => {
|
||||||
|
it('should only fetch published brews', () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
it('fetched brews should not have text or editId', () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
it('if admin, fetches also non-published brews, with editid', () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
it('if author, fetches also non-published brews, with editid', ()=>{
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Pagniation', () => {
|
||||||
|
it('should return the exact number of brews based on limit', () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
desscribe('Sorting', ()=>{
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user