0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 18:22:42 +00:00

Correct failing test.

This commit is contained in:
David Bolack
2024-11-24 18:58:50 -06:00
parent b6e445c445
commit 008b31e530
2 changed files with 4 additions and 4 deletions

View File

@@ -908,7 +908,7 @@ brew`);
});
describe('Get CSS', ()=>{
it('should return brew style content as CSS text', async ()=>{
const testBrew = { title: 'test brew', text: '```css\n\nI Have a style!\n````\n\n' };
const testBrew = { title: 'test brew', text: '```css\n\nI Have a style!\n```\n\n' };
const toBrewPromise = (brew)=>new Promise((res)=>res({ toObject: ()=>brew }));
api.getId = jest.fn(()=>({ id: '1', googleId: undefined }));

View File

@@ -88,19 +88,19 @@ const splitTextStyleAndMetadata = (brew)=>{
brew.text = brew.text.replaceAll('\r\n', '\n');
if(brew.text.startsWith('```metadata')) {
const index = brew.text.indexOf('\n```\n\n');
const metadataSection = brew.text.slice(11, index - 1);
const metadataSection = brew.text.slice(11, index + 1);
const metadata = yaml.load(metadataSection);
Object.assign(brew, _.pick(metadata, ['title', 'description', 'tags', 'systems', 'renderer', 'theme', 'lang']));
brew.text = brew.text.slice(index + 6);
}
if(brew.text.startsWith('```css')) {
const index = brew.text.indexOf('\n```\n\n');
brew.style = brew.text.slice(6, index - 1);
brew.style = brew.text.slice(7, index + 1);
brew.text = brew.text.slice(index + 6);
}
if(brew.text.startsWith('```snippets')) {
const index = brew.text.indexOf('\n```\n\n');
brew.snippets = yamlSnippetsToText(yaml.load(brew.text.slice(11, index - 1))).slice(0, -1);
brew.snippets = yamlSnippetsToText(yaml.load(brew.text.slice(11, index + 1))).slice(0, -1);
brew.text = brew.text.slice(index + 6);
}
};