Merge pull request #5146 from naturalcrit/Fix-homebrewery.api-tests

Fix homebrewery.api tests
This commit is contained in:
Trevor Buckner
2026-10-22 12:43:47 -04:00
committed by GitHub
2 changed files with 62 additions and 62 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ const api = {
metadata.trimSize = { width: brew?.trimSize?.width, height: brew?.trimSize?.height }; metadata.trimSize = { width: brew?.trimSize?.width, height: brew?.trimSize?.height };
text = `\`\`\`metadata\n` + text = `\`\`\`metadata\n` +
`${yaml.dump(metadata)}\n` + `${yaml.dump(metadata)}` +
`\`\`\`\n\n` + `\`\`\`\n\n` +
`${text}`; `${text}`;
return text; return text;
+61 -61
View File
@@ -1,6 +1,7 @@
/* eslint-disable max-lines */ /* eslint-disable max-lines */
import { splitTextStyleAndMetadata } from '../shared/helpers.js'; import { splitTextStyleAndMetadata } from '../shared/helpers.js';
import dedent from 'dedent';
describe('Tests for api', ()=>{ describe('Tests for api', ()=>{
let api; let api;
@@ -493,35 +494,35 @@ describe('Tests for api', ()=>{
}, },
}); });
expect(result).toEqual(`\`\`\`metadata expect(result).toEqual(dedent`
title: some title \`\`\`metadata
description: this is a description title: some title
tags: description: this is a description
- something tags:
- fun - something
renderer: v3 - fun
theme: phb renderer: v3
bleedSize: theme: phb
top: .125in columns: '2'
bottom: .125in columnGutter: .125in
inner: .125in license: None
outer: .125in legalAuthors: ''
safetySpace: bleedSize:
top: .25in top: .125in
bottom: .25in bottom: .125in
outer: .25in inner: .125in
inner: .5in outer: .125in
trimSize: safetySpace:
width: 8.5in top: .25in
height: 11in bottom: .25in
columns: '2' outer: .25in
columnGutter: .125in inner: .5in
license: None trimSize:
legalAuthors: '' width: 8.5in
height: 11in
\`\`\`
\`\`\` brew`);
brew`);
}); });
it('should set metadata and style', ()=>{ it('should set metadata and style', ()=>{
@@ -556,39 +557,39 @@ brew`);
}, },
}); });
expect(result).toEqual(`\`\`\`metadata expect(result).toEqual(dedent`
title: some title \`\`\`metadata
description: this is a description title: some title
tags: description: this is a description
- something tags:
- fun - something
renderer: v3 - fun
theme: phb renderer: v3
bleedSize: theme: phb
top: .125in columns: '2'
bottom: .125in columnGutter: .125in
inner: .125in license: None
outer: .125in legalAuthors: ''
safetySpace: bleedSize:
top: .25in top: .125in
bottom: .25in bottom: .125in
outer: .25in inner: .125in
inner: .5in outer: .125in
trimSize: safetySpace:
width: 8.5in top: .25in
height: 11in bottom: .25in
columns: '2' outer: .25in
columnGutter: .125in inner: .5in
license: None trimSize:
legalAuthors: '' width: 8.5in
height: 11in
\`\`\`
\`\`\` \`\`\`css
hello yes i am css
\`\`\`
\`\`\`css brew`);
hello yes i am css
\`\`\`
brew`);
}); });
}); });
describe('exclusion methods', ()=>{ describe('exclusion methods', ()=>{
@@ -704,12 +705,11 @@ brew`);
'title: asdf\n' + 'title: asdf\n' +
'bleedSize: {}\n' + 'bleedSize: {}\n' +
'safetySpace: {}\n' + 'safetySpace: {}\n' +
'trimSize: {}\n' + 'trimSize: {}' +
'\n' + '\n' +
'```\n' + '```\n' +
'\n' + '\n' +
'asdf', 'asdf',
textBin : undefined,
theme : '5ePHB', theme : '5ePHB',
thumbnail : '', thumbnail : '',
title : 'asdf', title : 'asdf',