mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-24 22:39:20 +00:00
Pull in frontend
This commit is contained in:
32
web/src/shared/components/__tests__/status.test.js
Normal file
32
web/src/shared/components/__tests__/status.test.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import React from "react";
|
||||
import { mount } from "enzyme";
|
||||
|
||||
import Status from "../status";
|
||||
import {
|
||||
STATUS_FAILURE,
|
||||
STATUS_RUNNING,
|
||||
STATUS_SUCCESS,
|
||||
} from "shared/constants/status";
|
||||
|
||||
jest.dontMock("../status");
|
||||
|
||||
describe("Status component", () => {
|
||||
test("updates on status change", () => {
|
||||
const status = mount(<Status status={STATUS_FAILURE} />);
|
||||
const instance = status.instance();
|
||||
|
||||
expect(
|
||||
instance.shouldComponentUpdate({ status: STATUS_FAILURE }),
|
||||
).toBeFalsy();
|
||||
expect(
|
||||
instance.shouldComponentUpdate({ status: STATUS_SUCCESS }),
|
||||
).toBeTruthy();
|
||||
expect(status.hasClass("failure")).toBeTruthy();
|
||||
});
|
||||
|
||||
test("uses the status as the class name", () => {
|
||||
const status = mount(<Status status={STATUS_RUNNING} />);
|
||||
|
||||
expect(status.hasClass("running")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user