Files
karma/ui/src/Components/MainModal/Configuration/FetchConfiguration.test.js
Łukasz Mierzwa da6368288a feat(ui): allow sorting alert grid
This adds the ability for user to sort the grid of alerts via selected attribute.
UI configuration is provided to setup if timestamps or labels should be used to sort alerts.
2019-02-15 17:23:37 +00:00

43 lines
1.2 KiB
JavaScript

import React from "react";
import { mount } from "enzyme";
import toDiffableHtml from "diffable-html";
import { Settings } from "Stores/Settings";
import { FetchConfiguration } from "./FetchConfiguration";
let settingsStore;
beforeEach(() => {
settingsStore = new Settings();
});
const FakeConfiguration = () => {
return mount(<FetchConfiguration settingsStore={settingsStore} />);
};
describe("<FetchConfiguration />", () => {
it("matches snapshot with default values", () => {
const tree = FakeConfiguration();
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
});
it("call to onChange() updates internal state", () => {
const tree = FakeConfiguration();
tree.instance().onChange(55);
expect(tree.instance().config.fetchInterval).toBe(55);
});
it("settings are updated on completed change", () => {
const tree = FakeConfiguration();
tree.instance().onChangeComplete(123);
expect(settingsStore.fetchConfig.config.interval).toBe(123);
});
it("custom interval value is rendered correctly", () => {
settingsStore.fetchConfig.config.interval = 66;
const component = FakeConfiguration();
expect(component.find("InputRange").props().value).toBe(66);
});
});