Skip to content

Commit

Permalink
Merge pull request #978 from gabrielburnworth/os_update_button
Browse files Browse the repository at this point in the history
Minor fixes and additions
  • Loading branch information
RickCarlino committed Sep 11, 2018
2 parents ecd9ab9 + 438f2fd commit dc5093d
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ describe("<FbosDetails/>", () => {
return {
botInfoSettings: bot.hardware.informational_settings,
dispatch: jest.fn(x => x(jest.fn(), fakeState)),
sourceFbosConfig: (x) => {
return { value: bot.hardware.configuration[x], consistent: true };
}
sourceFbosConfig: x =>
({ value: bot.hardware.configuration[x], consistent: true }),
};
};

Expand All @@ -33,6 +32,12 @@ describe("<FbosDetails/>", () => {
p.botInfoSettings.firmware_commit = "fakeFwCommit";
p.botInfoSettings.soc_temp = 48.3;
p.botInfoSettings.wifi_level = -49;
// tslint:disable-next-line:no-any
(p.botInfoSettings as any).uptime = 0;
// tslint:disable-next-line:no-any
(p.botInfoSettings as any).memory_usage = 0;
// tslint:disable-next-line:no-any
(p.botInfoSettings as any).disk_usage = 0;

const wrapper = mount(<FbosDetails {...p} />);
["Environment", "fakeEnv",
Expand All @@ -44,6 +49,9 @@ describe("<FbosDetails/>", () => {
"FAKETARGET CPU temperature", "48.3", "C",
"WiFi Strength", "-49dBm",
"Beta release Opt-In",
"Uptime", "0s",
"Memory usage", "0MB",
"Disk usage", "0%",
]
.map(string => expect(wrapper.text()).toContain(string));
});
Expand Down Expand Up @@ -94,6 +102,19 @@ describe("<FbosDetails/>", () => {
expect(wrapper.text()).toContain("CPU temperature: unknown");
expect(wrapper.text()).not.toContain("&deg;C");
});

it("doesn't display extra metrics when bot is offline", () => {
const p = fakeProps();
// tslint:disable-next-line:no-any
(p.botInfoSettings as any).uptime = undefined;
// tslint:disable-next-line:no-any
(p.botInfoSettings as any).memory_usage = undefined;
// tslint:disable-next-line:no-any
(p.botInfoSettings as any).disk_usage = undefined;
const wrapper = mount(<FbosDetails {...p} />);
["uptime", "usage"].map(metric =>
expect(wrapper.text().toLowerCase()).not.toContain(metric));
});
});

describe("colorFromTemp()", () => {
Expand Down

0 comments on commit dc5093d

Please sign in to comment.