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

Unit tests for Grovers, Measure nodes #91

Merged
merged 16 commits into from
Aug 26, 2021
Merged

Conversation

ttoktassynov
Copy link
Member

@ttoktassynov ttoktassynov commented Aug 20, 2021

Purpose

Add unit tests for Grovers, measure nodes, write a test util function to validate flow output

Changes

  • Fixed issue In node-red-node-test-helper input handler not called on errors and warnings #83 and now can test invalid input on Grovers' node in dcd0a5c
  • Added generic test util function to validate output of the flow based on the given input
  • Added a test case for Measure Node that checks if correct output is received in the end
  • Fixed Quantum Circuit to have a reference to shell instance, so that we could stop by referencing inputNode's shell instance later in the unit tests. Last three changes here 2dad31a
  • Refactored grovers_spec.js to use testUtil function correctOutputReceived to validate output 89d17fc
  • Changed the error condition testing so that error handling in the nodes are consistent, meaning that they still call done(err) in node constructor. Changes are in 535c054

New Requirements

  • Quantum Circuit Node has to store in its instance a reference to shell instance
  • Every error handling shouldn't call done(err), but rather call this.error(err.message) and return afterwards. This is because test helper will be able to test such conditions.

@ttoktassynov ttoktassynov marked this pull request as ready for review August 20, 2021 23:25
@ttoktassynov ttoktassynov added the enhancement New feature or request label Aug 20, 2021
quantum/nodes/grovers/grovers.js Outdated Show resolved Hide resolved
test/test-util.js Outdated Show resolved Hide resolved
- Increase timeout for `return success output on valid input` test to
  25000ms.
- Reduce timeout for all tests from 15000ms to 10000ms.
@louislefevre louislefevre merged commit aa94963 into master Aug 26, 2021
@louislefevre louislefevre deleted the timur/unit-tests branch August 26, 2021 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In node-red-node-test-helper input handler not called on errors and warnings
3 participants