-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removing jest and all of its crutches. * Switching to vitest. * Improving the coverage of setCountdown() branches. * Improving the branch coverage for makeMessageHandler(). * Restoring previous implementation of hasPermission flag, as more elegant and now covered by tests. * Ref: now it's safe to mock not implementation not only once.
- Loading branch information
Showing
24 changed files
with
517 additions
and
1,457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 0 seconds 1`] = `"in 0 seconds"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 0 seconds 1`] = `"in 0 seconds"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 1 seconds 1`] = `"in 1 second"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 1 seconds 1`] = `"in 1 second"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 30 seconds 1`] = `"in 30 seconds"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 30 seconds 1`] = `"in 30 seconds"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 59 seconds 1`] = `"in 59 seconds"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 59 seconds 1`] = `"in 59 seconds"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 60 seconds 1`] = `"in 1.0 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 60 seconds 1`] = `"in 1.0 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 61 seconds 1`] = `"in 1.0 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 61 seconds 1`] = `"in 1.0 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 90 seconds 1`] = `"in 1.5 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 90 seconds 1`] = `"in 1.5 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 119 seconds 1`] = `"in 2.0 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 119 seconds 1`] = `"in 2.0 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 120 seconds 1`] = `"in 2 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 120 seconds 1`] = `"in 2 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 121 seconds 1`] = `"in 2 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 121 seconds 1`] = `"in 2 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 300 seconds 1`] = `"in 5 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 300 seconds 1`] = `"in 5 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 600 seconds 1`] = `"in 10 minutes"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 600 seconds 1`] = `"in 10 minutes"`; | ||
|
||
exports[`Countdown helpers formatDeadline() helper Should format the supplied UNIX timestamp having offset 3600 seconds 1`] = `"in 1 hour"`; | ||
exports[`Countdown helpers > formatDeadline() helper > Should format the supplied UNIX timestamp having offset 3600 seconds 1`] = `"in 1 hour"`; | ||
|
||
exports[`Countdown helpers getCountdownDelay() helper should return refresh interval for supplied timestamp having offset 60 seconds 1`] = `1000`; | ||
exports[`Countdown helpers > getCountdownDelay() helper > should return refresh interval for supplied timestamp having offset 60 seconds 1`] = `1000`; | ||
|
||
exports[`Countdown helpers getCountdownDelay() helper should return refresh interval for supplied timestamp having offset 120 seconds 1`] = `1000`; | ||
exports[`Countdown helpers > getCountdownDelay() helper > should return refresh interval for supplied timestamp having offset 120 seconds 1`] = `1000`; | ||
|
||
exports[`Countdown helpers getCountdownDelay() helper should return refresh interval for supplied timestamp having offset 121 seconds 1`] = `60000`; | ||
exports[`Countdown helpers > getCountdownDelay() helper > should return refresh interval for supplied timestamp having offset 121 seconds 1`] = `60000`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const modelMock = jest.fn(); | ||
import { vi } from "vitest"; | ||
|
||
jest.mock("../model/OctoRelayModel", () => ({ OctoRelayViewModel: modelMock })); | ||
export const modelMock = vi.fn(); | ||
|
||
vi.mock("../model/OctoRelayModel", () => ({ OctoRelayViewModel: modelMock })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export const cancelMock = jest.fn(); | ||
export const toggleMock = jest.fn(); | ||
import { vi } from "vitest"; | ||
|
||
jest.mock("../helpers/actions", () => ({ | ||
export const cancelMock = vi.fn(); | ||
export const toggleMock = vi.fn(); | ||
|
||
vi.mock("../helpers/actions", () => ({ | ||
cancelTask: cancelMock, | ||
toggleRelay: toggleMock, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
export const disposerMock = jest.fn(); | ||
export const countdownMock = jest.fn(() => disposerMock); | ||
export const deadlineMock = jest.fn(() => "sample deadline"); | ||
import { vi } from "vitest"; | ||
|
||
jest.mock("../helpers/countdown", () => ({ | ||
export const disposerMock = vi.fn(); | ||
export const countdownMock = vi.fn(() => disposerMock); | ||
export const deadlineMock = vi.fn(() => "sample deadline"); | ||
|
||
vi.mock("../helpers/countdown", () => ({ | ||
setCountdown: countdownMock, | ||
formatDeadline: deadlineMock, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export const clearMock = jest.fn(); | ||
export const showMock = jest.fn(); | ||
import { vi } from "vitest"; | ||
|
||
jest.mock("../helpers/hints", () => ({ | ||
export const clearMock = vi.fn(); | ||
export const showMock = vi.fn(); | ||
|
||
vi.mock("../helpers/hints", () => ({ | ||
clearHints: clearMock, | ||
showHints: showMock, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export const handlerMock = jest.fn(); | ||
import { vi } from "vitest"; | ||
|
||
jest.mock("../model/messageHandler", () => ({ | ||
makeMessageHandler: jest.fn(() => handlerMock), | ||
export const handlerMock = vi.fn(); | ||
|
||
vi.mock("../model/messageHandler", () => ({ | ||
makeMessageHandler: vi.fn(() => handlerMock), | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.