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

Simplify issue lists in event test suite #49

Open
happy5214 opened this issue Mar 3, 2022 · 0 comments
Open

Simplify issue lists in event test suite #49

happy5214 opened this issue Mar 3, 2022 · 0 comments
Labels
quality Code quality, not must-fix tests Issues related to testcases

Comments

@happy5214
Copy link
Member

The expected issue lists in the event.spec.js test suite contain some redundant code, namely repeated calls to generateIssue and converterGenerateIssue. In the future, we should consider whether it would be desirable to condense these lists to include just the data and move those calls to the validator base functions.

For example, the current test in dataset.spec.js (a good example of one with multiple issue types), edited to the form of event.spec.js, would be:

[
  generateIssue('extension', {
    tag: testDatasets.multipleInvalid[0],
  }),
  generateIssue('unitClassInvalidUnit', {
    tag: testDatasets.multipleInvalid[1],
    unitClassUnits: legalTimeUnits.sort().join(','),
  }),
  converterGenerateIssue(
    'invalidTag',
    testDatasets.multipleInvalid[2],
    {},
    [0, 12],
  ),
]

Several possibilities exist for condensing this. Some are listed below.

{
  extension: [{
    tag: testDatasets.multipleInvalid[0],
  }],
  unitClassInvalidUnit: [{
    tag: testDatasets.multipleInvalid[1],
    unitClassUnits: legalTimeUnits.sort().join(','),
  }],
  invalidTag: [[
    testDatasets.multipleInvalid[2],
    {},
    [0, 12],
  ]],
}
@happy5214 happy5214 added the quality Code quality, not must-fix label Mar 3, 2022
@happy5214 happy5214 added the tests Issues related to testcases label May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality Code quality, not must-fix tests Issues related to testcases
Projects
None yet
Development

No branches or pull requests

1 participant