Skip to content

Conversation

@joshlory
Copy link
Contributor

Trying to get a better understanding of this codebase 😄, and maybe start to bump the code coverage number.

I added a few suggestions in code — feel free to accept / reject.

Josh Lory added 3 commits June 22, 2018 16:32
Is there a benefit to requiring these to be specified every time? Otherwise the API is more friendly if we have sensible default values.
@joshlory joshlory requested a review from Hamms June 22, 2018 23:37
src/subtype.js Outdated
if (['2_1', '2_2', '2_3'].includes(this.level_.id)) {
this.wallMap[y][x] = 0;
tile = 'null0';
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can nuke this special casing!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? I'd love to nuke special casing, but I'm pretty sure removing this would impact studio.code.org/hoc/1 through 3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryansloan is important to only show wood walls for puzzle 1, 2 & 4 of the original Hour of Code? The video currently shows the medley of wall blocks. Puzzle 3 switches to a mix of wall types, then 4 switches back to wood walls. All other puzzles are a mix of wall types.

Current:

image

Without the special case for 1, 2 & 4:

image

if (this.defaultFlowerColor_ === 'purple' &&
config.level.flowerType !== 'purpleNectarHidden') {
throw new Error(`bad flowerType for Bee: ${config.level.flowerType}`);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a benefit to requiring this to be specified every time? Otherwise the API is more friendly if we have sensible default values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call; this is much nicer

pegmanY: 0,
});

bee.reset();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do I need to call reset() here before I can use the bee instance? Should we be calling reset() in the constructor, so it's ready right away?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, probably. I don't know whether or not there is a good reason we aren't doing it that way; odds are good there was once a good reason for it, but after all the refactors this has been through that reason might no longer apply. I definitely support looking into changing the initialization process to include reset, but I would want to do so carefully.

@codecov-io
Copy link

codecov-io commented Jun 22, 2018

Codecov Report

Merging #13 into master will increase coverage by 1.73%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
+ Coverage   40.48%   42.22%   +1.73%     
==========================================
  Files          22       22              
  Lines        1371     1369       -2     
  Branches      223      223              
==========================================
+ Hits          555      578      +23     
+ Misses        682      663      -19     
+ Partials      134      128       -6
Impacted Files Coverage Δ
src/subtype.js 31.66% <100%> (+0.51%) ⬆️
src/bee.js 40.87% <100%> (+16.23%) ⬆️
src/gatherer.js 42.85% <0%> (+14.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 729eef6...4e5ec0b. Read the comment docs.

Copy link
Contributor

@Hamms Hamms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending the special casing work

@joshlory joshlory merged commit d8f1b8e into master Jun 28, 2018
@joshlory joshlory deleted the unit-test-get-nectar branch June 28, 2018 20:51
@joshlory
Copy link
Contributor Author

Special-casing extracted to PR #15 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants