* refactor: light tweaks for readability * refactor: simplify metadata functions * fix: most tests * test: fix utils tests * test: simplify mocks * WIP: update get-last-step-file-content * feat: finish create-next-step * fix: type error * test: provide mock meta.json for test * refactor: get meta path from project path * refactor: get project name from path * refactor: simplify getProjectMetaPath further Also removes some excessive mocking * refactor: remove more mocks, always clear .env * feat: update create-next-step * feat: update create-empty steps Also refactors slightly, so it's easier to insert steps into the meta * docs: update challenge-helper-script docs * feat: create-step-between * refactor: allow metadata parse errors to propagate * fix: convert reorderSteps to renameSteps * refactor: create-step-between -> insert-step * feat: update delete-step * refactor: consolidate commands into commands.ts * refactor: clean up and consolidation * refactor: more cleanup * fix: make cli args consistent Everything accepts a single integer and nothing else * refactor: renameSteps -> updateStepTitles * docs: update with the names and args * feat: add step validating meta + files are synced
57 lines
1.0 KiB
TypeScript
57 lines
1.0 KiB
TypeScript
import ObjectID from 'bson-objectid';
|
|
import { getStepTemplate } from './get-step-template';
|
|
|
|
// Note: evaluates at highlevel the process, but seedHeads and seedTails could
|
|
// be tested if more specifics are needed.
|
|
describe('getStepTemplate util', () => {
|
|
it('should be able to create a markdown', () => {
|
|
const baseOutput = `---
|
|
id: 60d4ebe4801158d1abe1b18f
|
|
title: Step 5
|
|
challengeType: 0
|
|
dashedName: step-5
|
|
---
|
|
|
|
# --description--
|
|
|
|
step 5 instructions
|
|
|
|
# --hints--
|
|
|
|
Test 1
|
|
|
|
\`\`\`js
|
|
|
|
\`\`\`
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
\`\`\`html
|
|
--fcc-editable-region--
|
|
|
|
--fcc-editable-region--
|
|
\`\`\`\n`;
|
|
|
|
const props = {
|
|
challengeId: new ObjectID('60d4ebe4801158d1abe1b18f'),
|
|
challengeSeeds: {
|
|
indexhtml: {
|
|
contents: '',
|
|
editableRegionBoundaries: [0, 2],
|
|
ext: 'html',
|
|
head: '',
|
|
id: '',
|
|
key: 'indexhtml',
|
|
name: 'index',
|
|
tail: ''
|
|
}
|
|
},
|
|
stepNum: 5
|
|
};
|
|
|
|
expect(getStepTemplate(props)).toEqual(baseOutput);
|
|
});
|
|
});
|