1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/public/js/__tests__/components/feature/ArchiveFeatureComponent-test.js

41 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-12-17 21:56:27 +01:00
jest.dontMock("../../../components/feature/ArchiveFeatureComponent");
jest.mock("../../../stores/FeatureToggleServerFacade");
jest.autoMockOff();
2014-12-17 21:56:27 +01:00
var React = require("react/addons");
var TestUtils = React.addons.TestUtils;
var FeatureArchive = require("../../../components/feature/ArchiveFeatureComponent");
var Server = require("../../../stores/FeatureToggleServerFacade");
2015-03-17 18:31:55 +01:00
var FeatureToggleStore = require("../../../stores/ArchivedToggleStore");
2014-12-17 21:56:27 +01:00
describe("FeatureForm", function () {
var Component;
beforeEach(function() {
var archivedToggles = [
{ name: "featureX" },
{ name: "featureY" }
];
Component = TestUtils.renderIntoDocument(
<FeatureArchive archivedFeatures={archivedToggles} />);
2014-12-17 21:56:27 +01:00
});
afterEach(function() {
React.unmountComponentAtNode(document.body);
});
it("should render two archived features", function() {
var rows = Component.getDOMNode().querySelectorAll("tbody tr");
2014-12-17 21:56:27 +01:00
expect(rows.length).toEqual(2);
});
it("should revive archived feature toggle", function() {
var button = Component.getDOMNode().querySelector("tbody button");
TestUtils.Simulate.click(button);
2014-12-17 21:56:27 +01:00
jest.runAllTimers();
expect(Server.reviveFeature).toBeCalled();
2014-12-17 21:56:27 +01:00
});
});