-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore (release): version 0.7.1 (#39)
- fix yarn conflict that is preventing merge due to main branch lock - revert unstable backstage package and its dependencies - changed release publishing to a manual process - add support for profile images - refactor oncall user list behavior to only show users on escalation level 1 - remove duplicates from oncall user list
- Loading branch information
Showing
8 changed files
with
160 additions
and
7 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 |
---|---|---|
|
@@ -39,6 +39,7 @@ export const mockPagerDutyApi: PagerDutyApi = { | |
email: '[email protected]', | ||
html_url: 'http://user', | ||
name: 'some-user', | ||
avatar_url: 'http://avatar', | ||
}, | ||
}, | ||
}, | ||
|
@@ -61,6 +62,7 @@ export const mockPagerDutyApi: PagerDutyApi = { | |
email: '[email protected]', | ||
html_url: 'http://user', | ||
name: 'some-user', | ||
avatar_url: 'http://avatar', | ||
}, | ||
}, | ||
}, | ||
|
@@ -122,21 +124,22 @@ export const mockPagerDutyApi: PagerDutyApi = { | |
}, | ||
|
||
async getOnCallByPolicyId() { | ||
const oncall = (name: string, escalation: number) => { | ||
const oncall = (id: string, name: string, escalation: number) => { | ||
return { | ||
user: { | ||
id: '123', | ||
id: id, | ||
name: name, | ||
html_url: 'http://assignee', | ||
summary: 'summary', | ||
email: '[email protected]', | ||
avatar_url: 'http://avatar', | ||
}, | ||
escalation_level: escalation, | ||
}; | ||
}; | ||
|
||
return { | ||
oncalls: [oncall('Jane Doe', 1), oncall('John Doe', 2)], | ||
oncalls: [oncall('1', 'Jane Doe', 1), oncall('2', 'John Doe', 2), oncall('3', 'James Doe', 1)], | ||
}; | ||
}, | ||
|
||
|
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 |
---|---|---|
|
@@ -40,6 +40,7 @@ const user: PagerDutyUser = { | |
summary: 'person1', | ||
email: '[email protected]', | ||
html_url: 'http://a.com/id1', | ||
avatar_url: 'http://a.com/id1/avatar', | ||
}; | ||
|
||
const service: PagerDutyService = { | ||
|
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 |
---|---|---|
|
@@ -79,6 +79,7 @@ const user: PagerDutyUser = { | |
summary: 'person1', | ||
email: '[email protected]', | ||
html_url: 'http://a.com/id1', | ||
avatar_url: 'http://a.com/id1/avatar', | ||
}; | ||
|
||
const service: PagerDutyService = { | ||
|
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 |
---|---|---|
|
@@ -57,8 +57,9 @@ describe('Escalation', () => { | |
id: 'p1', | ||
summary: 'person1', | ||
email: '[email protected]', | ||
html_url: 'http://a.com/id1', | ||
html_url: 'http://a.com/id1', | ||
} as PagerDutyUser, | ||
escalation_level: 1, | ||
}, | ||
], | ||
})); | ||
|
@@ -77,6 +78,139 @@ describe('Escalation', () => { | |
expect(mockPagerDutyApi.getOnCallByPolicyId).toHaveBeenCalledWith('abc'); | ||
}); | ||
|
||
it("Renders a list of users without duplicates", async () => { | ||
mockPagerDutyApi.getOnCallByPolicyId = jest | ||
.fn() | ||
.mockImplementationOnce(async () => ({ | ||
oncalls: [ | ||
{ | ||
user: { | ||
name: "person1", | ||
id: "p1", | ||
summary: "person1", | ||
email: "[email protected]", | ||
html_url: "http://a.com/id1", | ||
} as PagerDutyUser, | ||
escalation_level: 1, | ||
}, | ||
{ | ||
user: { | ||
name: "person2", | ||
id: "p2", | ||
summary: "person2", | ||
email: "[email protected]", | ||
html_url: "http://a.com/id2", | ||
} as PagerDutyUser, | ||
escalation_level: 1, | ||
}, | ||
{ | ||
user: { | ||
name: "person2", | ||
id: "p2", | ||
summary: "person2", | ||
email: "[email protected]", | ||
html_url: "http://a.com/id2", | ||
} as PagerDutyUser, | ||
escalation_level: 1, | ||
}, | ||
], | ||
})); | ||
|
||
const { getByText, queryByTestId, queryAllByText } = render( | ||
wrapInTestApp( | ||
<ApiProvider apis={apis}> | ||
<EscalationPolicy policyId="abc" /> | ||
</ApiProvider> | ||
) | ||
); | ||
await waitFor(() => !queryByTestId("progress")); | ||
|
||
expect(getByText("person1")).toBeInTheDocument(); | ||
expect(getByText("[email protected]")).toBeInTheDocument(); | ||
expect(queryAllByText("person2").length).toBe(1); | ||
expect(queryAllByText("[email protected]").length).toBe(1); | ||
expect(mockPagerDutyApi.getOnCallByPolicyId).toHaveBeenCalledWith("abc"); | ||
}); | ||
|
||
it("Renders only user(s) in escalation level 1", async () => { | ||
mockPagerDutyApi.getOnCallByPolicyId = jest | ||
.fn() | ||
.mockImplementationOnce(async () => ({ | ||
oncalls: [ | ||
{ | ||
user: { | ||
name: "person1", | ||
id: "p1", | ||
summary: "person1", | ||
email: "[email protected]", | ||
html_url: "http://a.com/id1", | ||
} as PagerDutyUser, | ||
escalation_level: 1, | ||
}, | ||
{ | ||
user: { | ||
name: "person2", | ||
id: "p2", | ||
summary: "person2", | ||
email: "[email protected]", | ||
html_url: "http://a.com/id2", | ||
} as PagerDutyUser, | ||
escalation_level: 2, | ||
}, | ||
], | ||
})); | ||
|
||
const { getByText, queryByTestId, queryByText } = render( | ||
wrapInTestApp( | ||
<ApiProvider apis={apis}> | ||
<EscalationPolicy policyId="abc" /> | ||
</ApiProvider> | ||
) | ||
); | ||
await waitFor(() => !queryByTestId("progress")); | ||
|
||
expect(getByText("person1")).toBeInTheDocument(); | ||
expect(getByText("[email protected]")).toBeInTheDocument(); | ||
expect(queryByText("person2")).not.toBeInTheDocument(); | ||
expect(queryByText("[email protected]")).not.toBeInTheDocument(); | ||
expect(mockPagerDutyApi.getOnCallByPolicyId).toHaveBeenCalledWith("abc"); | ||
}); | ||
|
||
it("Renders a user with profile picture", async () => { | ||
mockPagerDutyApi.getOnCallByPolicyId = jest | ||
.fn() | ||
.mockImplementationOnce(async () => ({ | ||
oncalls: [ | ||
{ | ||
user: { | ||
name: "person1", | ||
id: "p1", | ||
summary: "person1", | ||
email: "[email protected]", | ||
html_url: "http://a.com/id1", | ||
avatar_url: | ||
"https://gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y", | ||
} as PagerDutyUser, | ||
escalation_level: 1, | ||
}, | ||
], | ||
})); | ||
|
||
const { getByText, queryByTestId, getByAltText } = render( | ||
wrapInTestApp( | ||
<ApiProvider apis={apis}> | ||
<EscalationPolicy policyId="abc" /> | ||
</ApiProvider> | ||
) | ||
); | ||
await waitFor(() => !queryByTestId("progress")); | ||
|
||
expect(getByText("person1")).toBeInTheDocument(); | ||
expect(getByText("[email protected]")).toBeInTheDocument(); | ||
expect(getByAltText("User")).toHaveAttribute("src", "https://gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?f=y") | ||
expect(mockPagerDutyApi.getOnCallByPolicyId).toHaveBeenCalledWith("abc"); | ||
}); | ||
|
||
it('Handles errors', async () => { | ||
mockPagerDutyApi.getOnCallByPolicyId = jest | ||
.fn() | ||
|
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 |
---|---|---|
|
@@ -31,6 +31,7 @@ const user: PagerDutyUser = { | |
summary: 'person1', | ||
email: '[email protected]', | ||
html_url: 'http://a.com/id1', | ||
avatar_url: 'http://a.com/id1/avatar', | ||
}; | ||
|
||
const service: PagerDutyService = { | ||
|
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