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 broken tests #367

Merged
merged 2 commits into from
May 10, 2019
Merged

Fix broken tests #367

merged 2 commits into from
May 10, 2019

Conversation

cjbarth
Copy link
Collaborator

@cjbarth cjbarth commented Apr 26, 2019

There were two bugs in the code that were causing the tests to fail. Due to the way the tests were written tests failed as timeouts. I've also adjusted the tests so that when they fail they give useful information.

No functional changes were made to the test. The only changes were to correctly wrap async exception throwing blocks in a try...catch and then call done() properly so that mocha could properly report the error instead of having to wait 2 seconds for timeout and then reporting that instead of the actual error that occured.

Copy link
Contributor

@mlunoe mlunoe left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this!
Tested it out and this works for me and tests pass and report errors as expected

@cjbarth cjbarth force-pushed the multisaml-metadata branch from 1623809 to 2d8f9c0 Compare April 29, 2019 18:56
@cjbarth
Copy link
Collaborator Author

cjbarth commented Apr 29, 2019

As I was updating typings for v1.1 when it is released I found that there were some inconsistencies and metadata was being mishandled. Error handling was also broken.

I've corrected these issues in this PR as well.

done();
} catch (err2) {
done(err2);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This test does not appear to actually be async, so could be converted to a sync test without try/catch.

@markstos
Copy link
Contributor

@cjbarth I see that's a lot of work that's been put here.

I'm reluctant to merge this because the try/catch syntax is verbose and ugly. I also understand that's solving a real problem with sync errors being thrown in async test.

Now that Node 6.x is EOL'ed, we can drop support for it, which means it's safe to start using async/await in the code base. This could help clean up the tests, but to take advantage of it we should also update some functions to return a promise if no callback is provided.

Still, I realize a release is overdue for for the moment I have gratitude that this fixes for the tests for now, so I'm merging it.

@markstos markstos merged commit ce5351d into node-saml:master May 10, 2019
@cjbarth cjbarth deleted the multisaml-metadata branch May 13, 2019 16:10
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.

3 participants