Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organise utilities #59

Merged
merged 4 commits into from
May 30, 2018
Merged

Organise utilities #59

merged 4 commits into from
May 30, 2018

Conversation

ning-y
Copy link
Member

@ning-y ning-y commented May 29, 2018

Features

  • Organise notification.ts and registerServiceWorker.ts into their own utility directory
  • Slight refactor of name genericButton -> controlButton according to PR Add Source §2 #35
  • Remove unnecessary yield undefined according to issue Follow Up on Review of PR35 #37
  • Slight refactor in structure of ReplControl.tsx to list declarations in decreasing levels of abstraction
  • Improve test coverage of Repl.tsx from 67% to 100%
------------------------------|----------|----------|----------|----------|-------------------|
File                          |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
------------------------------|----------|----------|----------|----------|-------------------|
src/components/workspace      |     87.5 |    58.33 |    33.33 |    87.27 |                   |
  Repl.tsx (this PR)          |      100 |      100 |      100 |      100 |                   |
 src/components/workspace     |    70.69 |    29.17 |    33.33 |    70.18 |                   |
  Repl.tsx (master: 403ba81)  |    68.18 |    22.22 |      100 |    66.67 |... 66,74,75,81,90 |
------------------------------|----------|----------|----------|----------|-------------------|

Issues fixed

@ning-y ning-y requested a review from remo5000 May 29, 2018 04:36
</div>
</div>
)
}
}

const controlButton = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, can this be applied to Editor as well? I think it still uses genericButton

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good (and DRY), but how do you wanna go about it?

  1. Change Editor to have the same function controlButton
  2. .Export controlButton from here and import it into Editor
  3. Abstract controlButton into a separate file within workspace
  4. Abstract controlButton into a new/existing file under utils

I'm leaning towards (2) tbh

Copy link
Contributor

Choose a reason for hiding this comment

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

Since controlButton does not originate from here, I think abstracting into the utils folder is better. If there was something that belongs to ReplControl, it would make more sense to export.

ning-y added 4 commits May 30, 2018 17:24
- utils is a new directory under ./src/ holding misc modules that don't seem to
  fit anywhere else.
- createStore was excluded from utils since the store is a core part of our
  react/redux app, and so it does make sense as a standalone module in the root
  ./src/ directory
- Also fixed #37 unnecessary yield undefined.
Also avoided variable name negation by renaming its argument 'notMinimal' ->
'minimal'. Refactor ReplControl to list declarations in decreasing levels of
abstraction.

(addresses review in PR #35)
- Add a mockTypeError in mocks for situations that require a mock SourceError of
  some kind.
Also fixed typescript type errors on yarn start.
@ning-y
Copy link
Member Author

ning-y commented May 30, 2018

(rebased e3e4a34 to 44b5dd2 as 5c9fa5e to 36c7991 on 5c0d34f)

@ning-y ning-y merged commit 6de19a6 into master May 30, 2018
@ning-y ning-y deleted the org-utils branch May 30, 2018 09:36
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.

2 participants