mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix jest.advanceTimersByTime usage
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
6c6c9e8c13
commit
d89f238d48
@ -154,12 +154,13 @@ describe("encourage user to update when sufficient time passed since update was
|
|||||||
describe("given just enough time passes for medium update encouragement", () => {
|
describe("given just enough time passes for medium update encouragement", () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
jest.advanceTimersByTime(daysToMilliseconds(22));
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("has medium emotional indication in the button", () => {
|
it("has medium emotional indication in the button", () => {
|
||||||
const button = rendered.getByTestId("update-button");
|
const button = rendered.getByTestId("update-button");
|
||||||
|
|
||||||
|
jest.advanceTimersByTime(daysToMilliseconds(22));
|
||||||
|
|
||||||
expect(button).toHaveAttribute("data-warning-level", "medium")
|
expect(button).toHaveAttribute("data-warning-level", "medium")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -9,9 +9,9 @@ const setUpdateWarningLevelInjectable = getInjectable({
|
|||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const updateDownloadedDate = di.inject(updateDownloadedDateInjectable);
|
const updateDownloadedDate = di.inject(updateDownloadedDateInjectable);
|
||||||
const updateWarningLevel = di.inject(updateWarningLevelInjectable);
|
const updateWarningLevel = di.inject(updateWarningLevelInjectable);
|
||||||
const newLevel = new UpdateWarningLevelCalculator(updateDownloadedDate.value.get()).get();
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
const newLevel = new UpdateWarningLevelCalculator(updateDownloadedDate.value.get()).get();
|
||||||
updateWarningLevel.set(newLevel);
|
updateWarningLevel.set(newLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user