Clean up spaces/tabs for legibility

This commit is contained in:
Trevor Buckner
2026-09-22 20:14:12 -04:00
parent e59b60fe0e
commit 7a864b319f
+74 -84
View File
@@ -18,94 +18,30 @@ const emoji = 'df_d12_2';
const brewSnippetsThemeTest = [ const brewSnippetsThemeTest = [
{ {
name : 'Test Theme', name : 'Test Theme',
snippets : dedent `\snippet First Theme Snippet snippets : dedent `
I am the first theme snippet! \snippet First Theme Snippet
I am the first theme snippet!
\snippet Second Theme Snippet \snippet Second Theme Snippet
I am the second theme Snippet! I am the second theme Snippet!`,
`,
} }
]; ];
const brewSnippetsBrewTest = dedent` const brewSnippetsBrewTest = dedent`
\snippet First Brew Snippet \snippet First Brew Snippet
I am the first brew snippet! I am the first brew snippet!
\snippet Second Brew Snippet \snippet Second Brew Snippet
I am the second brew Snippet! I am the second brew Snippet!`;
`; describe(`brewSnippetsToJSON`, ()=>{
it('converts raw brew snippets without theme snippets to JSON', function() {
describe(`Helper function tests`, ()=>{
it('brewSnippetsToJSON without theme snippets', function() {
const testMenuObject = { const testMenuObject = {
groupName : 'Brew Snippets', groupName : 'Brew Snippets',
icon : 'fas fa-th-list', icon : 'fas fa-th-list',
snippets : [ view : 'text',
{ snippets : [{
name : 'Test Snippets JSON without theme snippets', name : 'Test Snippets JSON without theme snippets',
subsnippets : [
{
gen : 'I am the first brew snippet!\n',
name : 'First Brew Snippet'
}, {
gen : 'I am the second brew Snippet!',
name: 'Second Brew Snippet'
}
]
}
],
view : 'text'
};
const rendered = brewSnippetsToJSON(`Test Snippets JSON without theme snippets`, brewSnippetsBrewTest, null, true);
expect(rendered, `Input:\n${brewSnippetsBrewTest}\n${brewSnippetsThemeTest}`, { showPrefix: false }).toStrictEqual(testMenuObject);
});
it('brewSnippetsToJSON with theme snippets', function() {
const testMenuObject = {
groupName : 'Brew Snippets',
icon : 'fas fa-th-list',
snippets : [
{
gen : '',
icon : '',
name : 'Test Theme',
subsnippets : [
{
gen : 'I am the first theme snippet!\n',
icon : '',
name : 'First Theme Snippet',
},
{
gen : 'I am the second theme Snippet!',
icon : '',
name : 'Second Theme Snippet',
},
],
},
{
name : 'Test Snippets JSON without theme snippets',
subsnippets : [
{
gen : 'I am the first brew snippet!\n',
name : 'First Brew Snippet'
}, {
gen : 'I am the second brew Snippet!',
name: 'Second Brew Snippet'
}
]
}
],
view : 'text'
};
const rendered = brewSnippetsToJSON(`Test Snippets JSON without theme snippets`, brewSnippetsBrewTest, brewSnippetsThemeTest, true);
expect(rendered, `Input:\n${brewSnippetsBrewTest}\n${brewSnippetsThemeTest}`, { showPrefix: false }).toStrictEqual(testMenuObject);
});
it('Yaml SnippetstoText ', function() {
const brewSnippetsBrewTestAsYAML = [
{
subsnippets : [ subsnippets : [
{ {
gen : 'I am the first brew snippet!\n', gen : 'I am the first brew snippet!\n',
@@ -114,11 +50,65 @@ describe(`Helper function tests`, ()=>{
gen : 'I am the second brew Snippet!', gen : 'I am the second brew Snippet!',
name: 'Second Brew Snippet' name: 'Second Brew Snippet'
} }
] ]}]
} };
]; const rendered = brewSnippetsToJSON(`Test Snippets JSON without theme snippets`, brewSnippetsBrewTest, null, true);
const rendered = yamlSnippetsToText(brewSnippetsBrewTestAsYAML); expect(rendered).toStrictEqual(testMenuObject);
expect(rendered, `Input:\n${brewSnippetsBrewTestAsYAML}\n`, { showPrefix: false }).toBe(`${brewSnippetsBrewTest}\n`);
}); });
it('converts raw brew snippets with theme snippets to JSON', function() {
const testMenuObject = {
groupName : 'Brew Snippets',
icon : 'fas fa-th-list',
view : 'text',
snippets : [{
gen : '',
icon : '',
name : 'Test Theme',
subsnippets : [
{
gen : 'I am the first theme snippet!\n',
icon : '',
name : 'First Theme Snippet',
},
{
gen : 'I am the second theme Snippet!',
icon : '',
name : 'Second Theme Snippet',
},
]},
{
name : 'Test Snippets JSON with theme snippets',
subsnippets : [
{
gen : 'I am the first brew snippet!\n',
name : 'First Brew Snippet'
},
{
gen : 'I am the second brew Snippet!',
name: 'Second Brew Snippet'
}
]
}]};
const rendered = brewSnippetsToJSON(`Test Snippets JSON with theme snippets`, brewSnippetsBrewTest, brewSnippetsThemeTest, true);
expect(rendered).toStrictEqual(testMenuObject);
});
});
describe(`YAMLSnippetsToText`, ()=>{
it('converts brew snippet YAML to a string ', function() {
const brewSnippetsYAML = [{
subsnippets : [
{
gen : 'I am the first brew snippet!\n',
name : 'First Brew Snippet'
}, {
gen : 'I am the second brew Snippet!',
name: 'Second Brew Snippet'
}
]
}];
const rendered = yamlSnippetsToText(brewSnippetsYAML);
expect(rendered).toBe(`${brewSnippetsBrewTest}\n`);
});
}); });