diff --git a/packages/spacecat-shared-data-access/test/unit/models/api-key.test.js b/packages/spacecat-shared-data-access/test/unit/models/api-key.test.js index 847ab952..15e54a1f 100644 --- a/packages/spacecat-shared-data-access/test/unit/models/api-key.test.js +++ b/packages/spacecat-shared-data-access/test/unit/models/api-key.test.js @@ -59,6 +59,11 @@ describe('ApiKey Model tests', () => { 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'); });