Skip to content

Commit c06f869

Browse files
committed
chore: upgrade obsidian-e2e to 0.6.0
1 parent 54bb3d8 commit c06f869

3 files changed

Lines changed: 11 additions & 20 deletions

File tree

bun.lockb

32 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"jsdom": "^26.1.0",
3636
"obsidian": "1.11.4",
3737
"obsidian-dataview": "^0.5.68",
38-
"obsidian-e2e": "0.4.0",
38+
"obsidian-e2e": "0.6.0",
3939
"semantic-release": "^24.2.6",
4040
"svelte": "^4.2.19",
4141
"svelte-check": "^3.8.6",

tests/e2e/template-property-links.test.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,15 @@ async function runChoiceAndWaitForFile(
8585

8686
async function waitForFrontmatter(
8787
file: string,
88-
predicate: (frontmatter: Record<string, unknown> | null) => boolean,
88+
predicate: (frontmatter: { authors: string[] }) => boolean,
8989
) {
90-
const filePath = sandbox.path(file);
91-
return obsidian.waitFor(async () => {
92-
const rawFrontmatter = await obsidian.dev.eval(
93-
`(() => {
94-
const file = app.vault.getFileByPath(${JSON.stringify(filePath)});
95-
if (!file) return null;
96-
return app.metadataCache.getFileCache(file)?.frontmatter ?? null;
97-
})()`,
98-
);
99-
const frontmatter =
100-
rawFrontmatter && typeof rawFrontmatter === "object"
101-
? (rawFrontmatter as Record<string, unknown>)
102-
: null;
103-
104-
return predicate(frontmatter) ? frontmatter : undefined;
105-
}, WAIT_OPTS);
90+
return await obsidian.metadata.waitForFrontmatter<{
91+
authors: string[];
92+
}>(
93+
sandbox.path(file),
94+
predicate,
95+
WAIT_OPTS,
96+
);
10697
}
10798

10899
async function runTeardownStep(
@@ -211,7 +202,7 @@ describe("issue 1140: list properties with links", () => {
211202
const frontmatter = await waitForFrontmatter(
212203
"qa-1140-single-link.md",
213204
(value) =>
214-
Array.isArray(value?.authors) && value.authors.length === 1,
205+
Array.isArray(value.authors) && value.authors.length === 1,
215206
);
216207

217208
expect(frontmatter).toMatchObject({
@@ -228,7 +219,7 @@ describe("issue 1140: list properties with links", () => {
228219
const frontmatter = await waitForFrontmatter(
229220
"qa-1140-multi-link.md",
230221
(value) =>
231-
Array.isArray(value?.authors) && value.authors.length === 2,
222+
Array.isArray(value.authors) && value.authors.length === 2,
232223
);
233224

234225
expect(frontmatter).toMatchObject({

0 commit comments

Comments
 (0)