1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/public/js/__tests__/components/feature/ArchiveFeatureComponent-test.js
Anders Olsen Sandvik a96a9f38ce #108 Add eslint-config-spt and remove jshint (#111)
* #108 Add eslint-config-spt

* #108 Ignore bundle.js file

* #108 Change eslint ignore path to a glob file

* Remove jshint and follow more of eslint rules
2020-02-20 08:30:24 +01:00

40 lines
1.2 KiB
JavaScript

jest.dontMock("../../../components/feature/ArchiveFeatureComponent");
jest.mock("../../../stores/FeatureToggleActions");
jest.autoMockOff();
var React = require("react/addons");
var TestUtils = React.addons.TestUtils;
var FeatureArchive = require("../../../components/feature/ArchiveFeatureComponent");
var FeatureActions = require("../../../stores/FeatureToggleActions");
describe("FeatureForm", function () {
var Component;
beforeEach(function() {
var archivedToggles = [
{ name: "featureX" },
{ name: "featureY" }
];
Component = TestUtils.renderIntoDocument(
<FeatureArchive archivedFeatures={archivedToggles} />);
});
afterEach(function() {
React.unmountComponentAtNode(document.body);
});
it("should render two archived features", function() {
var rows = Component.getDOMNode().querySelectorAll("tbody tr");
expect(rows.length).toEqual(2);
});
it("should revive archived feature toggle", function() {
var button = Component.getDOMNode().querySelector("tbody button");
TestUtils.Simulate.click(button);
jest.runAllTimers();
expect(FeatureActions.revive.triggerPromise).toBeCalled();
});
});