mirror of
https://github.com/prymitive/karma
synced 2026-05-19 04:26:41 +00:00
fix(tests): add missing HistoryLabels tests
This commit is contained in:
34
ui/src/Components/Labels/HistoryLabel/index.test.js
Normal file
34
ui/src/Components/Labels/HistoryLabel/index.test.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import React from "react";
|
||||
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
import { AlertStore } from "Stores/AlertStore";
|
||||
|
||||
import { HistoryLabel } from ".";
|
||||
|
||||
let alertStore;
|
||||
|
||||
beforeEach(() => {
|
||||
alertStore = new AlertStore([]);
|
||||
});
|
||||
|
||||
describe("<HistoryLabel />", () => {
|
||||
it("renders name, matcher and value if all are set", () => {
|
||||
const tree = shallow(
|
||||
<HistoryLabel
|
||||
alertStore={alertStore}
|
||||
name="foo"
|
||||
matcher="="
|
||||
value="bar"
|
||||
/>
|
||||
);
|
||||
expect(tree.text()).toBe("foo=bar");
|
||||
});
|
||||
|
||||
it("renders only value if name is falsey", () => {
|
||||
const tree = shallow(
|
||||
<HistoryLabel alertStore={alertStore} name="" matcher="" value="bar" />
|
||||
);
|
||||
expect(tree.text()).toBe("bar");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user