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

Tests are tied to implementation too closely #39

Open
purplecabbage opened this issue Aug 6, 2019 · 1 comment
Open

Tests are tied to implementation too closely #39

purplecabbage opened this issue Aug 6, 2019 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@purplecabbage
Copy link
Member

All commands flag tests test for the specific values of the flags.
This means that we essentially have written the same code in the test+implementation, and if we ever want to change the implementation we have to do it in 2 places.

example:

ActionList.flags = {
  ...RuntimeBaseCommand.flags,
  // example usage:  aio runtime:action:list --limit 10 --skip 2
  'limit': flags.integer({
    char: 'l',
    description: 'only return LIMIT number of actions from the collection (default 30)',
    hidden: false, // hide from help
    multiple: false, // allow setting this flag multiple times
    required: false // not mandatory
  }),
  'skip': flags.integer({
    char: 's',
    description: 'exclude the first SKIP number of actions from the result',
    multiple: false, // allow setting this flag multiple times
    required: false // not mandatory
  }),
  'json': flags.boolean({
    description: 'output raw json'
  })
}

and the test:

test('flags', async () => {
  expect(TheCommand.flags).toMatchObject({
    'limit': {
      'char': 'l',
      'description': 'only return LIMIT number of actions from the collection (default 30)',
      'hidden': false,
      'multiple': false,
      'required': false
    },
    'skip': {
      'char': 's',
      'description': 'exclude the first SKIP number of actions from the result',
      'multiple': false,
      'required': false
    }
  })
})
@purplecabbage purplecabbage added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 6, 2019
@shazron shazron added the enhancement New feature or request label Nov 26, 2019
@adobe-bot
Copy link

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants