forked from AxisCommunications/backstage-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into improvements
- Loading branch information
Showing
9 changed files
with
712 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@axis-backstage/plugin-jira-dashboard-backend': minor | ||
--- | ||
|
||
The Backstage user entity profile email is now used as default for "Assigned to me" filters. Made the JIRA_EMAIL_SUFFIX optional, so it still can be used if Backstage email does not match the one in Jira. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { getDefaultFiltersForUser } from './filters'; | ||
import { mockServices } from '@backstage/backend-test-utils'; | ||
import { UserEntity } from '@backstage/catalog-model'; | ||
|
||
describe('getDefaultFiltersForUser', () => { | ||
const mockConfig = mockServices.rootConfig({ | ||
data: { | ||
jiraDashboard: { | ||
userEmailSuffix: '@backstage.com', | ||
}, | ||
}, | ||
}); | ||
|
||
const mockUserEntity: UserEntity = { | ||
apiVersion: 'backstage.io/v1beta1', | ||
kind: 'User', | ||
metadata: { | ||
namespace: 'default', | ||
name: 'fridaja', | ||
description: 'Software Developer', | ||
}, | ||
|
||
spec: { | ||
profile: { | ||
displayName: 'Frida Jacobsson', | ||
email: '[email protected]', | ||
}, | ||
}, | ||
}; | ||
|
||
it('returns userEmailSuffix email when config is provided', () => { | ||
const filters = getDefaultFiltersForUser(mockConfig, mockUserEntity); | ||
expect(filters).toHaveLength(3); | ||
expect(filters).toContainEqual( | ||
expect.objectContaining({ | ||
shortName: 'ME', | ||
query: expect.stringContaining('[email protected]'), | ||
}), | ||
); | ||
}); | ||
|
||
it('returns backstage email when userEmailSuffix config is not provided', () => { | ||
const filters = getDefaultFiltersForUser( | ||
mockServices.rootConfig(), | ||
mockUserEntity, | ||
); | ||
expect(filters).toHaveLength(3); | ||
expect(filters).toContainEqual( | ||
expect.objectContaining({ | ||
shortName: 'ME', | ||
query: expect.stringContaining('[email protected]'), | ||
}), | ||
); | ||
}); | ||
|
||
it('do not return Assigned to me filter when userEntity is not provided', () => { | ||
const filters = getDefaultFiltersForUser(mockConfig); | ||
expect(filters).toHaveLength(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.