test(shared): remove unsafe test assertions
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as fs from "node:fs"
|
||||
import * as path from "node:path"
|
||||
import { log } from "../logger"
|
||||
import { isRecord } from "../record-type-guard"
|
||||
import { writeFileAtomically } from "../write-file-atomically"
|
||||
|
||||
/**
|
||||
@@ -48,14 +49,9 @@ export function readAppliedMigrations(configPath: string): Set<string> {
|
||||
return new Set()
|
||||
}
|
||||
const content = fs.readFileSync(sidecarPath, "utf-8")
|
||||
const parsed = JSON.parse(content) as unknown
|
||||
if (
|
||||
parsed &&
|
||||
typeof parsed === "object" &&
|
||||
!Array.isArray(parsed) &&
|
||||
Array.isArray((parsed as MigrationsSidecar).appliedMigrations)
|
||||
) {
|
||||
return new Set((parsed as MigrationsSidecar).appliedMigrations.filter((m): m is string => typeof m === "string"))
|
||||
const parsed: unknown = JSON.parse(content)
|
||||
if (isRecord(parsed) && Array.isArray(parsed.appliedMigrations)) {
|
||||
return new Set(parsed.appliedMigrations.filter((migration): migration is string => typeof migration === "string"))
|
||||
}
|
||||
return new Set()
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user