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

Fix restart button when Done #2610

Merged
merged 2 commits into from
Jun 3, 2022
Merged

Conversation

llewelld
Copy link
Contributor

When the flashing process completes the user is asked if they want to
flash another device. Currently the button seems to do nothing; these
changes return the app back to the start screen to allow the user to
attempt another flashing process.

@llewelld llewelld force-pushed the fix-restart branch 2 times, most recently from 91ba393 to b82ce16 Compare April 26, 2022 12:27
@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #2610 (4fc2df5) into master (c86c0e3) will increase coverage by 0.41%.
The diff coverage is 80.00%.

❗ Current head 4fc2df5 differs from pull request most recent head 20d4fca. Consider uploading reports for the commit 20d4fca to get more accurate results

@@            Coverage Diff             @@
##           master    #2610      +/-   ##
==========================================
+ Coverage   76.20%   76.61%   +0.41%     
==========================================
  Files          29       29              
  Lines         954      958       +4     
==========================================
+ Hits          727      734       +7     
+ Misses        227      224       -3     
Impacted Files Coverage Δ
src/core/core.js 72.66% <0.00%> (ø)
src/main.js 45.09% <100.00%> (+8.36%) ⬆️
src/core/plugins/core/plugin.js 100.00% <0.00%> (ø)

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 c86c0e3...20d4fca. Read the comment docs.

src/core/core.js Outdated Show resolved Hide resolved
src/core/core.js Outdated Show resolved Hide resolved
return core.prepare("a", true).then(() => {
expect(core.readConfigFile).toHaveBeenCalledWith("a");
expect(core.readConfigFile).toHaveBeenCalledTimes(1);
core.readConfigFile.mockRestore();
Copy link
Contributor

Choose a reason for hiding this comment

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

You should restore the mocks in a .finally to make sure you never influence other test cases

Copy link
Contributor Author

@llewelld llewelld May 9, 2022

Choose a reason for hiding this comment

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

Could you provide me a bit more guidance here please?

Is this different from the restore before each of the tests?

Copy link
Member

Choose a reason for hiding this comment

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

should not be needed, but jest can be weird sometimes

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I was looking for the config option, didn't notice the manual beforeEach - then you shouldn't need the restores at all

Copy link
Member

Choose a reason for hiding this comment

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

yep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to clarify, I'm happy to make changes here, but I'd still need some guidance on what's needed.

src/main.spec.js Show resolved Hide resolved
Copy link
Member

@NeoTheThird NeoTheThird left a comment

Choose a reason for hiding this comment

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

looking pretty good, thank you!

src/core/core.js Outdated Show resolved Hide resolved
src/core/core.js Outdated Show resolved Hide resolved
return core.prepare("a", true).then(() => {
expect(core.readConfigFile).toHaveBeenCalledWith("a");
expect(core.readConfigFile).toHaveBeenCalledTimes(1);
core.readConfigFile.mockRestore();
Copy link
Member

Choose a reason for hiding this comment

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

should not be needed, but jest can be weird sometimes

llewelld and others added 2 commits May 9, 2022 21:01
When the flashing process completes the user is asked if they want to
flash another device. Currently the button seems to do nothing; these
changes return the app back to the start screen to allow the user to
attempt another flashing process.

Co-authored-by: Johannah Sprinz <[email protected]>
Adds a unit test for the restart event.
@amartinz
Copy link
Member

Could you please npm run lint? :)

@NeoTheThird NeoTheThird merged commit 54064a2 into ubports:master Jun 3, 2022
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.

4 participants