Skip to content

An open-source, self-hosted system for apps built with web technologies.

The about and icon tests close the store before removing their home, so Windows can delete it

zohayrslilehd3d98943bab4
diff --git a/tests/system-about.test.ts b/tests/system-about.test.ts
index b8856a1..561f5a9 100644
--- a/tests/system-about.test.ts
+++ b/tests/system-about.test.ts
@@ -8,9 +8,9 @@ import { name, release, version } from "@/source/identity"
test("the System says what it is from its identity, and when it started", async () => {
const home = await mkdtemp(join(tmpdir(), "phreshos-about-"))
+ const before = Date.now()
+ const application = await Application.initialize(home, { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") })
try {
- const before = Date.now()
- const application = await Application.initialize(home, { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") })
const about = application.system.about()
assert.deepEqual(about, { name, version, release, startedAt: about.startedAt })
@@ -19,5 +19,8 @@ test("the System says what it is from its identity, and when it started", async
assert(about.startedAt.getTime() >= before && about.startedAt.getTime() <= Date.now())
assert.equal(application.system.about().startedAt.getTime(), about.startedAt.getTime())
}
- finally { await rm(home, { recursive: true, force: true }) }
+ finally {
+ await application.store.disconnect()
+ await rm(home, { recursive: true, force: true })
+ }
}, 60_000)
diff --git a/tests/system-icon.test.ts b/tests/system-icon.test.ts
index fe6c596..a3fce93 100644
--- a/tests/system-icon.test.ts
+++ b/tests/system-icon.test.ts
@@ -8,9 +8,8 @@ import Application from "@server/core/application"
test("the System renders its own icon at each standard size, and only those", async () => {
const home = await mkdtemp(join(tmpdir(), "phreshos-icon-"))
+ const application = await Application.initialize(home, { system: resolve("assets/logo.png"), defaultProgram: resolve("assets/default-icon.png") })
try {
- const application = await Application.initialize(home, { system: resolve("assets/logo.png"), defaultProgram: resolve("assets/default-icon.png") })
-
for (const [size, length] of [["small", 32], ["medium", 64], ["large", 128]] as const) {
const metadata = await sharp(Buffer.from(await application.system.icon(size))).metadata()
assert.equal(metadata.format, "png")
@@ -21,5 +20,8 @@ test("the System renders its own icon at each standard size, and only those", as
assert.equal((await sharp(Buffer.from(await application.system.icon())).metadata()).width, 64)
await assert.rejects(application.system.icon("huge"), /small, medium, or large/)
}
- finally { await rm(home, { recursive: true, force: true }) }
+ finally {
+ await application.store.disconnect()
+ await rm(home, { recursive: true, force: true })
+ }
}, 60_000)