Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Commit

Permalink
Add day 6 solution and test
Browse files Browse the repository at this point in the history
  • Loading branch information
missmatsuko committed May 6, 2019
1 parent d025c27 commit 3715ca6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions 2019-05/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,13 @@ Use your `findModuleIndex` function to find the "propulsion" module and then loa
> *Hint:* Make sure you are building on top of the last challenge. ;P
>
> [Click here to access the Help Forum.](https://21day-forum.lighthouselabs.ca/)
#### Challenge #6
"NAVIGATION SYSTEM needed," LARRY tells you. Navigation is important - you can't move through space without it!

Use your already-defined methods and load in the "navigation" module. It's pretty simple once you have the functions to do it, and LARRY's eyes are finally easing from red back to normal.

> ##### Hint
> Great news, you have the ability to find a module's index. We need the navigation module's index, and then we want to load that module in, by index.
>
> [Click here to access the Help Forum.](https://21day-forum.lighthouselabs.ca/)
4 changes: 2 additions & 2 deletions 2019-05/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const availableModules = [
essential: true,
},
{
name: 'sensors',
name: 'navigation',
size: 8204,
enabled: true,
essential: true,
Expand Down Expand Up @@ -111,6 +111,6 @@ const findModuleIndex = (name) => {


/** EXECUTIONS **/
const modulesToLoad = ['life-support', 'propulsion'];
const modulesToLoad = ['life-support', 'propulsion', 'navigation'];
enableModule(findModuleIndex('life-support'));
loadModules(findModuleIndices(modulesToLoad));
8 changes: 8 additions & 0 deletions 2019-05/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ test('Challenge #5: `propulsion` module added to shipModules', () => {
const propulsionModule = availableModules[2];
expect(shipModules[1]).toEqual(propulsionModule);
});

// Challenge #6
test('Challenge #6: `navigation` module added to shipModules', () => {
const shipModules = solution.__get__('ship').modules;
const availableModules = solution.__get__('availableModules');
const navigationModule = availableModules[3];
expect(shipModules[2]).toEqual(navigationModule);
});

0 comments on commit 3715ca6

Please sign in to comment.