mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-15 12:40:12 +00:00
test: tighten local retry recovery assertions
This commit is contained in:
1 parent
8b77127af5
commit
09c17e90dd
5 files changed
+100
-30
No files matched your search
@@ -0,0 +1,24 @@
|
||||
/** Decoded database fields inspected by the plain-text local retry scenarios. */
|
||||
export interface DatabaseTextObservation {
|
||||
/** Metadata type reported by the loaded revision. */
|
||||
readonly type?: unknown;
|
||||
/** Content datatype reported by the database reader. */
|
||||
readonly datatype?: unknown;
|
||||
/** Concatenated revision content, before any encoding assumption. */
|
||||
readonly body?: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Match the exact text and representation required by the Markdown fixtures.
|
||||
* @param observation - The loaded database branch, or an unavailable observation.
|
||||
* @param expected - Exact text expected from the corresponding Vault file.
|
||||
* @returns True only for plain Metadata and plain content with exactly the expected text.
|
||||
* @remarks This closure-free function is also serialised into the isolated Obsidian evaluation.
|
||||
* Base64 characters stored as plain text are different bytes, even when they encode the expected text.
|
||||
*/
|
||||
export function matchesPlainDatabaseText(
|
||||
observation: DatabaseTextObservation | null | undefined,
|
||||
expected: string
|
||||
): boolean {
|
||||
return observation?.type === "plain" && observation.datatype === "plain" && observation.body === expected;
|
||||
}
|
||||
Reference in new issue
Block a user