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

Reduce JS test warnings #28772

Merged
merged 2 commits into from
Aug 24, 2017
Merged

Reduce JS test warnings #28772

merged 2 commits into from
Aug 24, 2017

Conversation

PVince81
Copy link
Contributor

Description

Remove "ERROR: undefined" at the end of the tests which were due to the
"onbeforeunload" event.
Removed "download.svg" errors.
Removed warnings about missing plurals.

For the rest, need to spend some time to replace the last tipsy usages and port some of the notification calls.

Related Issue

None raised

Motivation and Context

Warnings are annoying.

How Has This Been Tested?

make test-js
See that there are less warnings.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Remove "ERROR: undefined" at the end of the tests which were due to the
"onbeforeunload" event.
Removed "download.svg" errors.
Removed warnings about missing plurals.
@PVince81
Copy link
Contributor Author

for the remaining parts I raised #28773.

OC.Notification.hide();

expect(warnStub.calledOnce).toEqual(true);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is a good approach. Expecting that a warning message will popup doesn't feel good.

The warning message shouldn't popup in the first place, so we should try to fix the cause of the warning first. In addition, we shouldn't expect that the warn method will be called because it isn't essential for the test. As we don't check a "log" method of any logger will be called (thinking in PHP), we shouldn't check if a "warn" method will be called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cause of the warning is that some code out there (users page) is still using this method without arguments.

The expectation of this test is that a warning does appear, so I think it's ok here.
If this bothers you then I should probably remove this test completely.
But the point of the test was also to make sure that hiding still works even if the arg is missing.

Or if you like I can just remove the expectation but keep the method stubbed to avoid output.

Copy link
Member

Choose a reason for hiding this comment

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

Or if you like I can just remove the expectation but keep the method stubbed to avoid output.

I think it's this (with a comment to explain why this is stubbed), or make the code not to use the warn method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jvillafanez
Copy link
Member

I'd definitely remove the expectations for the warning message in the console: they're not part of what we want to test. What we want to test is the global behaviour: you call hide() and the first message in the html is removed. We aren't interested in a console message poping somewhere the same way we aren't interested in whether a log message shows when a function is called.

@PVince81
Copy link
Contributor Author

@jvillafanez I've removed the "expect()" block

@jvillafanez
Copy link
Member

👍

@PVince81 PVince81 merged commit 37f9771 into master Aug 24, 2017
@PVince81 PVince81 deleted the jstest-reduce-warnings branch August 24, 2017 08:27
DeepDiver1975 pushed a commit that referenced this pull request Nov 3, 2017
DeepDiver1975 added a commit that referenced this pull request Nov 3, 2017
…034eca680160791808cd

[stable10] Merge pull request #28772 from owncloud/jstest-reduce-warn…
@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants