1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/packages/unleash-frontend/public/js/__tests__/components/feature/FeatureForm-test.js
2020-02-20 08:30:26 +01:00

36 lines
1.1 KiB
JavaScript

'use strict';
jest.dontMock("../../../components/feature/FeatureForm");
const React = require("react/addons");
const TestUtils = React.addons.TestUtils;
const FeatureForm = require("../../../components/feature/FeatureForm");
describe("FeatureForm", () => {
let Component;
const strategies = [
{ name: "default" }
];
afterEach(() => {
React.unmountComponentAtNode(document.body);
});
describe("new", () => {
it("should render empty form", () => {
Component = TestUtils .renderIntoDocument(<FeatureForm strategies={strategies} />);
const name = Component.getDOMNode().querySelectorAll("input");
expect(name[0].value).toEqual("");
});
});
describe("edit", () => {
const feature = { name: "Test", strategy: "unknown" };
it("should show unknown strategy as default", () => {
Component = TestUtils .renderIntoDocument(<FeatureForm feature={feature} strategies={strategies} />);
const strategySelect = Component.getDOMNode().querySelector("select");
expect(strategySelect.value).toEqual("default");
});
});
});