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
Add unit tests for Application.ticker setter #4730
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for being willing to help. Definitely could use some help with writing more tests! Glad you're eager to help. Let me know if you'd like to join the PixiJS Slack.
As for this PR, couple of things:
- Please remove the use of the fat-arrow
=>
with Mocha, it actually loses the global context, which we'd like to retain for handling variables and other useful bits (like setting timeouts, slow, etc). As a practice, we keep that in usingfunction
. - Not sure
beforeEach
is a good choice here. Even though that theautoStart
test is the exception, in the future creating with a variety of constructor options is desirable. Would get messy withbeforeEach
. - I would just add a
before
in yourdescribe
and setthis.app = new PIXI.Application()
, then referencethis.app
in your ticker tests. Make sure to destroy it withafter
.
hi @bigtimebuddy, thank you for code review. I will fix it later. Yeah, I would like to join to pixijs slack |
Just send me your email address: matt@mattkarl.com |
dc8cf70
to
8272b5c
Compare
Hi @bigtimebuddy, Could you please review it again. I seem, I also fix typo, that |
d0e119b
to
3c76088
Compare
test/core/Application.js
Outdated
|
||
describe('set ticker', function () | ||
{ | ||
const self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking much better. One small change can you remove self
and just use this
within your tests. Means the same thing. No need to cache this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigtimebuddy
in this case I will use it('<test name>', () =>
instead of it('<test name>', function ()
, in order to use this
inside a test. Is it ok? As I remember, you wrote:
Please remove the use of the fat-arrow => with Mocha, it actually loses the global context, which we'd like to retain for handling variables and other useful bits (like setting timeouts, slow, etc). As a practice, we keep that in using function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually in Mocha it’s all the same context, whether inside it, or containing describe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, cool! didn't know, thank you, fixed it
3c76088
to
18b247d
Compare
@bigtimebuddy , could you please review again. As I believe, I fixed all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, thanks @schipiga.
And good first PixiJS PR!
thank you :) |
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. |
Hello folks! I like autotests and would like to start to contribute to your project