mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-10 02:42:43 +00:00
Fix tests
This commit is contained in:
@@ -309,8 +309,6 @@ const api = {
|
|||||||
if(isStaticTheme(req.brew.renderer, req.brew.theme)) //Check if parent is staticBrew
|
if(isStaticTheme(req.brew.renderer, req.brew.theme)) //Check if parent is staticBrew
|
||||||
rendererPath = `${_.upperFirst(req.brew.renderer)}/`;
|
rendererPath = `${_.upperFirst(req.brew.renderer)}/`;
|
||||||
|
|
||||||
console.log(`getBrewThemeCSS for ${brew.shareId}`);
|
|
||||||
console.log(`and parentThemeImport for ${brew.theme}`);
|
|
||||||
const parentThemeImport = `@import url(\"/css/${rendererPath}${req.brew.theme}\");\n\n`;
|
const parentThemeImport = `@import url(\"/css/${rendererPath}${req.brew.theme}\");\n\n`;
|
||||||
const themeLocationComment = `/* From Brew: ${req.protocol}://${req.get('host')}/share/${req.brew.shareId} */\n\n`;
|
const themeLocationComment = `/* From Brew: ${req.protocol}://${req.get('host')}/share/${req.brew.shareId} */\n\n`;
|
||||||
return res.status(200).send(`${parentThemeImport}${themeLocationComment}${req.brew.style}`);
|
return res.status(200).send(`${parentThemeImport}${themeLocationComment}${req.brew.style}`);
|
||||||
@@ -323,8 +321,6 @@ const api = {
|
|||||||
res.setHeader('Content-Type', 'text/css');
|
res.setHeader('Content-Type', 'text/css');
|
||||||
res.setHeader('Cache-Control', 'public, max-age: 43200, must-revalidate');
|
res.setHeader('Cache-Control', 'public, max-age: 43200, must-revalidate');
|
||||||
const themeParent = Themes[req.params.renderer][req.params.id].baseTheme;
|
const themeParent = Themes[req.params.renderer][req.params.id].baseTheme;
|
||||||
console.log(`getStaticThemeCSS for ${req.params.id}`);
|
|
||||||
console.log(`and parentThemeImport for ${themeParent}`);
|
|
||||||
const parentThemeImport = themeParent ? `@import url(\"/css/${req.params.renderer}/${themeParent}\");\n/* Static Theme ${Themes[req.params.renderer][themeParent].name} */\n` : '';
|
const parentThemeImport = themeParent ? `@import url(\"/css/${req.params.renderer}/${themeParent}\");\n/* Static Theme ${Themes[req.params.renderer][themeParent].name} */\n` : '';
|
||||||
return res.status(200).send(`${parentThemeImport}@import url(\"/themes/${req.params.renderer}/${req.params.id}/style.css\");\n/* Static Theme ${Themes[req.params.renderer][req.params.id].name} */\n`);
|
return res.status(200).send(`${parentThemeImport}@import url(\"/themes/${req.params.renderer}/${req.params.id}/style.css\");\n/* Static Theme ${Themes[req.params.renderer][req.params.id].name} */\n`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,15 +287,12 @@ describe('Tests for api', ()=>{
|
|||||||
thumbnail : '',
|
thumbnail : '',
|
||||||
textBin : undefined,
|
textBin : undefined,
|
||||||
version : undefined,
|
version : undefined,
|
||||||
userThemes : {
|
createdAt : undefined,
|
||||||
Brew : {}
|
gDrive : false,
|
||||||
},
|
style : undefined,
|
||||||
createdAt : undefined,
|
trashed : false,
|
||||||
gDrive : false,
|
updatedAt : undefined,
|
||||||
style : undefined,
|
views : 0
|
||||||
trashed : false,
|
|
||||||
updatedAt : undefined,
|
|
||||||
views : 0
|
|
||||||
});
|
});
|
||||||
expect(next).toHaveBeenCalled();
|
expect(next).toHaveBeenCalled();
|
||||||
expect(api.getId).toHaveBeenCalledWith(req);
|
expect(api.getId).toHaveBeenCalledWith(req);
|
||||||
@@ -600,7 +597,7 @@ brew`);
|
|||||||
expect(res.status).toHaveBeenCalledWith(200);
|
expect(res.status).toHaveBeenCalledWith(200);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
//////////////////////////////
|
||||||
describe('getBrewThemeWithUserParent', ()=>{
|
describe('getBrewThemeWithUserParent', ()=>{
|
||||||
it('should collect parent theme and brew style - returning as css with user-theme parent imported.', async ()=>{
|
it('should collect parent theme and brew style - returning as css with user-theme parent imported.', async ()=>{
|
||||||
const toBrewPromise = (brew)=>new Promise((res)=>res({ toObject: ()=>brew }));
|
const toBrewPromise = (brew)=>new Promise((res)=>res({ toObject: ()=>brew }));
|
||||||
@@ -643,7 +640,7 @@ brew`);
|
|||||||
expect(res.status).toHaveBeenCalledWith(404);
|
expect(res.status).toHaveBeenCalledWith(404);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
describe('deleteBrew', ()=>{
|
describe('deleteBrew', ()=>{
|
||||||
it('should handle case where fetching the brew returns an error', async ()=>{
|
it('should handle case where fetching the brew returns an error', async ()=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user