InternetHealthReport / ihr-website

Vue.js code for IHR website
https://ihr.iijlab.net/ihr/en
GNU General Public License v3.0
65 stars 122 forks source link

Enhancement Test Suite For GripAPI Plugin Module #697

Closed RickDeb2004 closed 11 months ago

RickDeb2004 commented 11 months ago

Synchronous Validation of Asynchronous Code:

"Improve variable naming in getGripAlarms test

Enhance code documentation for getGripAlarms test

Improve Jest assertion in getGripAlarms test

Make validateResultSchema asynchronous for Jest testing.

RickDeb2004 commented 11 months ago

@romain-fontugne is this approach good?

romain-fontugne commented 11 months ago

@mohamedawnallah do we need to implement these changes?

mohamedawnallah commented 11 months ago

I don't think we need these changes for multiple reasons: 1) We're already await on the promise returned from GripApiPlugin.getGripAlarms before validating the schema result expected schema. validate(result). https://github.com/InternetHealthReport/ihr-website/blob/e94c718ee88cc2415f61be44dad4d43bf02911da/src/plugins/tests/GripApi.test.js#L57 2) I don't think modularity would be helpful because we have only one test case and this gets it complicated in return. 3) I don't think the documentation is very helpful here because the function name indicates cleary what it does so adding more documentation would become redundant.

Additional Context

Mostly, Testing files here follow AAA (Arrange, Act, Assert) pattern: https://learn.microsoft.com/en-us/visualstudio/test/unit-test-basics?view=vs-2022#write-your-tests

RickDeb2004 commented 11 months ago

I don't think we need these changes for multiple reasons:

  1. We're already await on the promise returned from GripApiPlugin.getGripAlarms before validating the schema result expected schema. validate(result). https://github.com/InternetHealthReport/ihr-website/blob/e94c718ee88cc2415f61be44dad4d43bf02911da/src/plugins/tests/GripApi.test.js#L57
  2. I don't think modularity would be helpful because we have only one test case and this gets it complicated in return.
  3. I don't think the documentation is very helpful here because the function name indicates cleary what it does so adding more documentation would become redundant.

Additional Context

Mostly, Testing files here follow AAA (Arrange, Act, Assert) pattern: https://learn.microsoft.com/en-us/visualstudio/test/unit-test-basics?view=vs-2022#write-your-tests

yes I am looking into it.