op-js icon indicating copy to clipboard operation
op-js copied to clipboard

Consider account requirements on a per suite/test basis

Open chrisdunnbirch opened this issue 2 years ago • 0 comments

Problems

  1. Some suites, for example eventsApi.test.ts, require that the active account selected in the CLI is a Teams or Business account
  2. We may want to test behaviour when there is no active account selected in the CLI

In both of these instances we encounter problems because jest.setup.ts forces the suites to sign in as the account configured in the OP_ACCOUNT env variable. The configured account may not be a Teams or Business account, and forcing this sign in precludes us from testing signed out behaviour.

Thoughts

  • Can we create helpers for op signin and op signout that we use on a per suite/test basis to configure the CLI as we need it for the specific tests, and remove the setGlobalFlags call from jest.setup.ts?
  • Do we need separate env variables for each account type for testing functionality available only to specific account types? if so, how does this affect external contributors who cannot create 1Password accounts at will?

chrisdunnbirch avatar Jun 01 '22 21:06 chrisdunnbirch