Skip to content

Commit

Permalink
Add a basic test for nested examples.
Browse files Browse the repository at this point in the history
Part of #2.
  • Loading branch information
jkomoros committed Jun 25, 2023
1 parent 45caf1d commit df9725b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const expandSeedData = (idFromParent : SeedID, data : SeedData, result : Expande
(resultData as any)[key] = subReference;
}

//For now just add all seeds, an effective pass-through
result.seeds[id] = resultData;
return id;
};
Expand Down
26 changes: 26 additions & 0 deletions test/base/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,32 @@ describe('Garden smoke test', () => {
});
});

it('a nested seed is legal', async() => {
const garden = loadTestGarden([]);
//We can't just do a manually typed SeedPacket because its type doesn't
//explicitly allow nesting due to the error descrbied in
//makeNestedSeedData, issue #16.
const packet = seedPacket.parse({
version: 0,
seeds: {
'': {
'type': 'log',
'value': {
'type': 'log',
'value': true
}
}
}
});
garden.plantSeedPacket('test/base/foo.json', packet);
const seed = await garden.seed('');
const result = await seed.grow();
const golden = true;
assert.deepStrictEqual(result, golden);
});


//TODO: a named inner value doesn't pass.
});


Expand Down

0 comments on commit df9725b

Please sign in to comment.