This repository has been archived by the owner on Jan 22, 2020. It is now read-only.
-
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.
Add service detail view and increase test coverage.
- Loading branch information
Showing
45 changed files
with
1,271 additions
and
148 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
alerts/*.yml | ||
build/ | ||
public/service-detail/* | ||
node_modules/ |
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,31 @@ | ||
const alerts = [ | ||
{ | ||
alertLogged: '2016-12-05-17-23-45-42', | ||
alertOccurred: '2016-12-05-17-20-12-34', | ||
description: 'The decline in spirograph and the rise in gang activity', | ||
graph: 'https://frinkiac.com/img/S07E02/1108189.jpg', | ||
link: 'https://frinkiac.com/episode/S07E02/1108189', | ||
resolved: false, | ||
severity: 'h' | ||
}, | ||
{ | ||
alertLogged: '2016-12-17-16-53-12-23', | ||
alertOccurred: '2016-12-17-12-30-12-34', | ||
description: 'Disco record sales were up 400%', | ||
graph: 'https://frinkiac.com/img/S08E11/288721.jpg', | ||
link: 'https://frinkiac.com/episode/S08E11/290589', | ||
resolved: true, | ||
severity: 'l' | ||
}, | ||
{ | ||
alertLogged: '2016-12-14-12-45-12-34', | ||
alertOccurred: '2016-12-14-12-30-12-34', | ||
description: 'As intelligence goes up, happiness often goes down', | ||
graph: 'https://frinkiac.com/img/S12E09/1066440.jpg', | ||
link: 'https://frinkiac.com/episode/S12E09/1066440', | ||
resolved: false, | ||
severity: 'm' | ||
} | ||
]; | ||
|
||
export default alerts; |
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,23 @@ | ||
// What our YAML looks like after being JSON-ified | ||
const newServiceDetailData = { | ||
'2016_12_17_11_53_12_34': { | ||
description: 'First test alert', | ||
graph: 'https://www.mozilla.org/', | ||
link: 'https://twitter.com/search?q=%23mozaloha&src=typd', | ||
resolved: false, | ||
severity: '1', | ||
time: '2016_12_17_12_30_12_34' | ||
}, | ||
'2016_12_14_16_53_12_34': { | ||
description: 'Second test alert', | ||
graph: 'https://www.mozilla.org/', | ||
link: 'https://twitter.com/search?q=%23mozaloha&src=typd', | ||
resolved: true, | ||
severity: '1', | ||
time: '2016_12_14_12_30_12_34' | ||
}, | ||
lastUpdate: '2016_12_17_20_01_11_22', | ||
message: 'Service data updated.' | ||
} | ||
|
||
export default newServiceDetailData; |
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,43 @@ | ||
const services = [ | ||
{ | ||
display: true, | ||
group: 'group1', | ||
hasDetail: false, | ||
id: 1, | ||
link: 'test link', | ||
name: 'test service 1', | ||
order: 1, | ||
status: 'healthy' | ||
}, | ||
{ | ||
display: true, | ||
hasDetail: true, | ||
id: 2, | ||
link: 'test link', | ||
name: 'test service 2', | ||
order: 2, | ||
status: 'healthy' | ||
}, | ||
{ | ||
display: true, | ||
group: 'group1', | ||
hasDetail: false, | ||
id: 3, | ||
link: 'test link', | ||
name: 'test service 3', | ||
order: 3, | ||
status: 'warning' | ||
}, | ||
{ | ||
display: true, | ||
group: 'group2', | ||
hasDetail: false, | ||
id: 4, | ||
link: 'test link', | ||
name: 'test service 4', | ||
order: 10, | ||
status: 'healthy' | ||
} | ||
]; | ||
|
||
export default services; |
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
local-dev/src/__tests__/__snapshots__/GlobalStatus.test.js.snap
This file was deleted.
Oops, something went wrong.
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,77 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import GlobalStatus from '../../components/GlobalStatus'; | ||
|
||
const mockClearDesktopNotify = jest.fn(); | ||
|
||
describe('render GlobalStatus', () => { | ||
test('renders a healthy GlobalStatus', () => { | ||
const component = renderer.create( | ||
<GlobalStatus status='healthy' | ||
message='test' | ||
notifyMessage={false} | ||
desktopNotify={false} | ||
clearDesktopNotify={mockClearDesktopNotify} /> | ||
); | ||
|
||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('renders a warning GlobalStatus', () => { | ||
const component = renderer.create( | ||
<GlobalStatus status='healthy' | ||
message='test' | ||
notifyMessage={false} | ||
desktopNotify={false} | ||
clearDesktopNotify={mockClearDesktopNotify} /> | ||
); | ||
|
||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('renders a failed GlobalStatus', () => { | ||
const component = renderer.create( | ||
<GlobalStatus status='healthy' | ||
message='test' | ||
notifyMessage={false} | ||
desktopNotify={false} | ||
clearDesktopNotify={mockClearDesktopNotify} /> | ||
); | ||
|
||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('renders a pending GlobalStatus', () => { | ||
const component = renderer.create( | ||
<GlobalStatus status='healthy' | ||
message='test' | ||
notifyMessage={false} | ||
desktopNotify={false} | ||
clearDesktopNotify={mockClearDesktopNotify} /> | ||
); | ||
|
||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
test('GlobalStatus sends a desktop notification', () => { | ||
// tests can't actually send a desktop notification | ||
GlobalStatus.prototype.sendDesktopNotification = jest.fn(() => true); | ||
// tests don't like looking for file paths, so we create a predictable stub | ||
GlobalStatus.prototype.statusToIcon = jest.fn(() => 'stub'); | ||
|
||
const component = renderer.create( | ||
<GlobalStatus status='healthy' | ||
message='playtime is fun' | ||
notifyMessage={true} | ||
desktopNotify={true} | ||
clearDesktopNotify={mockClearDesktopNotify} /> | ||
); | ||
|
||
expect(GlobalStatus.prototype.sendDesktopNotification).toHaveBeenCalledWith('playtime is fun', 'stub'); | ||
}); |
4 changes: 2 additions & 2 deletions
4
...-dev/src/__tests__/ServiceSummary.test.js → ...tests__/components/ServiceSummary.test.js
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.