Skip to content

Commit

Permalink
test(project): Agrega prueba para validar comportamiento sugerido en …
Browse files Browse the repository at this point in the history
  • Loading branch information
lupomontero committed May 22, 2024
1 parent 7d7718b commit e031017
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# A project

## Índice

Blah blah blah

***

## 1. Preámbulo

Blah blah blah

## 2. Resumen del proyecto

Blah blah blah
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
track: web-dev
tracks:
- web-dev
learningObjectives:
- dom/selectors
- dom/events
- dom/manipulation
variants:
- name: node
learningObjectives:
- node
- id: dom/manipulation
exclude: true
38 changes: 38 additions & 0 deletions lib/__tests__/__snapshots__/project.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,44 @@ exports[`parseProject > does not duplicate optional lo if its present in both no
]
`;

exports[`parseProject > excludes nested objectives in variant 1`] = `
[
{
"id": "dom/selectors",
},
{
"id": "dom/events",
},
{
"id": "dom/manipulation",
},
]
`;

exports[`parseProject > excludes nested objectives in variant 2`] = `
[
{
"id": "node/npm-install",
},
{
"id": "node/package.json",
},
{
"id": "node/npm-scripts",
},
{
"id": "node/process",
},
{
"id": "node/filesystem",
},
{
"exclude": true,
"id": "dom/manipulation",
},
]
`;

exports[`parseProject > expands learning objectives children when only parent is mentioned 1`] = `
[
{
Expand Down
14 changes: 14 additions & 0 deletions lib/__tests__/project.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ describe('parseProject', () => {
});
});

it('excludes nested objectives in variant', () => {
const p = resolveFixturePath('01-a-project-with-variant-excluding-granular-objectives');
return parseProject(p, {
repo: 'Laboratoria/bootcamp',
version: '1.0.0',
lo: path.join(__dirname, '__fixtures__', 'learning-objectives'),
}, pkg)
.then((result) => {
const [variant] = result.variants;
expect(result.learningObjectives).toMatchSnapshot();
expect(variant.learningObjectives).toMatchSnapshot();
});
});

it('throws when LO does not have an id', () => {
const p = resolveFixturePath('01-a-project-with-invalid-learning-objectives');
expect.assertions(1);
Expand Down

0 comments on commit e031017

Please sign in to comment.