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

Update Auto Asserting Mocks to better handle async tests #258

Open
chrisdp opened this issue Jan 20, 2024 · 1 comment
Open

Update Auto Asserting Mocks to better handle async tests #258

chrisdp opened this issue Jan 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@chrisdp
Copy link
Collaborator

chrisdp commented Jan 20, 2024

The current implementation related to Auto Asserting Mocks will always call clean and assert stubs and mocks the moment after calling the test group. This results in anything that happens async after that initial call will have it's stubs and mocks blown away. We should update this logic to be called after the group completes for async tests.

Consider the following test for example:

@async
@it("async with stub call for node function")
function _()
  m.stubCall(SetLabelText, function(text)
    m.wasCalled = true
    m.testSuite.assertEqual(text, "")
    m.testSuite.assertTrue(true)
    m.testSuite.done()
    ? "done three"
  end function)

  delayCall(0.02, SetLabelText)
end function

The current logic would result in the stub for SetLabelText to be cleared before it was ever called.

@chrisdp chrisdp added the bug Something isn't working label Jan 20, 2024
@chrisdp
Copy link
Collaborator Author

chrisdp commented Jan 24, 2024

As part of #259 the auto asserting was disabled by default for async tests. The scope of this ticket would be to re-enable this functionality, but for it to respect the completion of the Async test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant