fix(tests): resolve mobx errors

This commit is contained in:
Łukasz Mierzwa
2023-09-04 11:24:23 +01:00
committed by Łukasz Mierzwa
parent fd73a5ad21
commit 98dc112fdc
4 changed files with 56 additions and 35 deletions

View File

@@ -13,12 +13,15 @@ beforeEach(() => {
const NonEqualMatchers = ["!=", "=~", "!~", ">", "<"];
const MockColors = () => {
alertStore.data.colors["foo"] = {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
alertStore.data.setColors({
foo: {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
},
},
};
...alertStore.data.colors,
});
};
const ShallowLabel = (

View File

@@ -67,23 +67,29 @@ describe("<FilteringLabel />", () => {
});
it("label with dark background color should have 'components-label-dark' class", () => {
alertStore.data.colors["foo"] = {
bar: {
brightness: 125,
background: "rgba(4,5,6,200)",
alertStore.data.setColors({
foo: {
bar: {
brightness: 125,
background: "rgba(4,5,6,200)",
},
},
};
...alertStore.data.colors,
});
const tree = MountedFilteringLabel("foo", "bar");
expect(tree.hasClass("components-label-dark")).toBe(true);
});
it("label with bright background color should have 'components-label-bright' class", () => {
alertStore.data.colors["foo"] = {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
alertStore.data.setColors({
foo: {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
},
},
};
...alertStore.data.colors,
});
const tree = MountedFilteringLabel("foo", "bar");
expect(tree.hasClass("components-label-bright")).toBe(true);
});

View File

@@ -35,12 +35,15 @@ describe("<HistoryLabel />", () => {
});
it("label with dark background color should have 'components-label-dark' class", () => {
alertStore.data.colors["foo"] = {
bar: {
brightness: 125,
background: "rgba(4,5,6,200)",
alertStore.data.setColors({
foo: {
bar: {
brightness: 125,
background: "rgba(4,5,6,200)",
},
},
};
...alertStore.data.colors,
});
const tree = ShallowHistoryLabel("foo", "=", "bar").find(
".components-label",
);
@@ -48,12 +51,15 @@ describe("<HistoryLabel />", () => {
});
it("label with bright background color should have 'components-label-bright' class", () => {
alertStore.data.colors["foo"] = {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
alertStore.data.setColors({
foo: {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
},
},
};
...alertStore.data.colors,
});
const tree = ShallowHistoryLabel("foo", "=", "bar").find(
".components-label",
);

View File

@@ -23,12 +23,15 @@ describe("<StaticLabel />", () => {
});
it("label with dark background color should have 'components-label-dark' class", () => {
alertStore.data.colors["foo"] = {
bar: {
brightness: 125,
background: "rgba(4,5,6,200)",
alertStore.data.setColors({
foo: {
bar: {
brightness: 125,
background: "rgba(4,5,6,200)",
},
},
};
...alertStore.data.colors,
});
const tree = MountedStaticLabel();
expect(
tree.find(".components-label").hasClass("components-label-dark"),
@@ -36,12 +39,15 @@ describe("<StaticLabel />", () => {
});
it("label with bright background color should have 'components-label-bright' class", () => {
alertStore.data.colors["foo"] = {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
alertStore.data.setColors({
foo: {
bar: {
brightness: 200,
background: "rgba(4,5,6,200)",
},
},
};
...alertStore.data.colors,
});
const tree = MountedStaticLabel();
expect(
tree.find(".components-label").hasClass("components-label-bright"),