simplify test
This commit is contained in:
parent
26dd80e021
commit
43672d33c1
|
|
@ -60,20 +60,8 @@ console.log(`\n${colors.cyan}CodexSetup.transformToSkillFormat tests${colors.res
|
||||||
{
|
{
|
||||||
const input = `---\ndescription: "it's a test"\n---\n\nBody.`;
|
const input = `---\ndescription: "it's a test"\n---\n\nBody.`;
|
||||||
const result = setup.transformToSkillFormat(input, 'test-skill');
|
const result = setup.transformToSkillFormat(input, 'test-skill');
|
||||||
|
const expected = `---\nname: test-skill\ndescription: 'it''s a test'\n---\n\nBody.`;
|
||||||
// Verify the inner quote is escaped: description: 'it''s a test'
|
assert(result === expected, 'description with apostrophe produces valid YAML', `got: ${JSON.stringify(result)}`);
|
||||||
const descLine = result.split('\n').find((l) => l.startsWith('description:'));
|
|
||||||
const value = descLine.replace('description: ', '');
|
|
||||||
|
|
||||||
// Check that single quotes inside the value are properly escaped
|
|
||||||
// In YAML single-quoted scalars, a literal ' must be written as ''
|
|
||||||
const innerContent = value.slice(1, -1); // strip outer quotes
|
|
||||||
const hasUnescapedQuote = innerContent.match(/[^']'[^']/);
|
|
||||||
assert(
|
|
||||||
!hasUnescapedQuote,
|
|
||||||
'description with apostrophe produces valid YAML (no unescaped inner quotes)',
|
|
||||||
`description line: ${descLine}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Single-quoted input with pre-escaped apostrophe (YAML '' escape) ---
|
// --- Single-quoted input with pre-escaped apostrophe (YAML '' escape) ---
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue