26 lines
1 KiB
TypeScript
26 lines
1 KiB
TypeScript
import { describe, expect, test } from "bun:test"
|
|
import { updaterAction } from "./updater-action"
|
|
|
|
describe("updaterAction", () => {
|
|
test("disables update actions when the platform has no updater", () => {
|
|
expect(updaterAction(undefined)).toEqual({ label: "settings.updates.action.checkNow" })
|
|
})
|
|
|
|
test("projects updater transitions into one settings action", () => {
|
|
expect(updaterAction({ status: "idle" })).toEqual({
|
|
label: "settings.updates.action.checkNow",
|
|
run: "check",
|
|
})
|
|
expect(updaterAction({ status: "checking" })).toEqual({ label: "settings.updates.action.checking" })
|
|
expect(updaterAction({ status: "downloading", version: "2.0.0" })).toEqual({
|
|
label: "settings.updates.action.downloading",
|
|
})
|
|
expect(updaterAction({ status: "ready", version: "2.0.0" })).toEqual({
|
|
label: "toast.update.action.installRestart",
|
|
run: "install",
|
|
})
|
|
expect(updaterAction({ status: "installing", version: "2.0.0" })).toEqual({
|
|
label: "settings.updates.action.installing",
|
|
})
|
|
})
|
|
})
|