Skip to content

Commit 8da5c35

Browse files
committed
test config
Signed-off-by: shmck <[email protected]>
1 parent e1e66b8 commit 8da5c35

File tree

2 files changed

+67
-5
lines changed

2 files changed

+67
-5
lines changed

src/templates/coderoad.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ config:
2929
commands:
3030
[]
3131
# - npm install
32-
## App versions helps to ensure compatability with the Extension
33-
appVersions:
34-
{}
35-
## Ensure compatability with a minimal VSCode CodeRoad version
36-
# vscode: '>=0.7.0'
32+
## App versions helps to ensure compatability with the Extension
33+
appVersions:
34+
{}
35+
## Ensure compatability with a minimal VSCode CodeRoad version
36+
# vscode: '>=0.7.0'
3737
## Repo information to load code from
3838
##
3939
repo:

tests/parse.test.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,66 @@ levels:
181181
expect(result.summary.description).toBe(expected.summary.description);
182182
expect(result.levels[0].content).toBe(expected.levels[0].content);
183183
});
184+
185+
it("should parse the tutorial config", () => {
186+
const md = `# Title
187+
188+
Description.
189+
`;
190+
const yaml = `
191+
config:
192+
testRunner:
193+
command: ./node_modules/.bin/mocha
194+
args:
195+
filter: --grep
196+
tap: --reporter=mocha-tap-reporter
197+
directory: coderoad
198+
setup:
199+
commits:
200+
- abcdefg1
201+
commands: []
202+
appVersions:
203+
vscode: '>=0.7.0'
204+
repo:
205+
uri: https://path.to/repo
206+
branch: aBranch
207+
dependencies:
208+
- name: node
209+
version: '>=10'
210+
`;
211+
const result = parse(md, yaml);
212+
const expected = {
213+
summary: {
214+
description: "Description.\n\nSecond description line",
215+
},
216+
config: {
217+
testRunner: {
218+
command: "./node_modules/.bin/mocha",
219+
args: {
220+
filter: "--grep",
221+
tap: "--reporter=mocha-tap-reporter",
222+
},
223+
directory: "coderoad",
224+
setup: {
225+
commits: ["abcdefg1"],
226+
commands: [],
227+
},
228+
},
229+
repo: {
230+
uri: "https://path.to/repo",
231+
branch: "aBranch",
232+
},
233+
dependencies: [
234+
{
235+
name: "node",
236+
version: ">=10",
237+
},
238+
],
239+
appVersions: {
240+
vscode: ">=0.7.0",
241+
},
242+
},
243+
};
244+
expect(result.config).toEqual(expected.config);
245+
});
184246
});

0 commit comments

Comments
 (0)