Skip to content

Commit

Permalink
fix: Add a unit test for imports.write_all_domains scope (#384)
Browse files Browse the repository at this point in the history
## Related Issues

Add a unit test for imports.write_all_domains scope

---------

Co-authored-by: bhellema <[email protected]>
Co-authored-by: Ben Helleman <[email protected]>
Co-authored-by: semantic-release-bot <[email protected]>
  • Loading branch information
4 people committed Sep 25, 2024
1 parent 6a9bd0d commit 800ec89
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ describe('ApiKey Model tests', () => {
expect(apiKey.getCreatedAt()).is.not.empty;
});

it('creates an ApiKey object for a user with scope - imports.write_all_domains', () => {
const apiKey = createApiKey({ ...validApiKey, scopes: [{ name: 'imports.write_all_domains', domains: [] }] });
expect(apiKey.getScopes()).to.deep.equal([{ name: 'imports.write_all_domains', domains: [] }]);
});

it('creates an ApiKey object for a user with scope - imports.write', () => {
const apiKey = createApiKey({ ...validApiKey, scopes: [{ name: 'imports.write', domains: ['https://adobe.com', 'https://test.com'] }] });
expect(apiKey.getScopes()).to.deep.equal([{ name: 'imports.write', domains: ['https://adobe.com', 'https://test.com'] }]);
});

it('throws an error if revokedAt is not a valid date', () => {
expect(() => createApiKey({ ...validApiKey, revokedAt: 'invalid-date' })).to.throw('revokedAt should be a valid ISO 8601 string: invalid-date');
});
Expand Down

0 comments on commit 800ec89

Please sign in to comment.