mirror of
https://github.com/gethomepage/homepage.git
synced 2026-04-09 03:31:36 -07:00
DRY
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
import { expect } from "vitest";
|
||||
|
||||
export function findServiceBlockByLabel(container, label) {
|
||||
const blocks = Array.from(container.querySelectorAll(".service-block"));
|
||||
return blocks.find((b) => b.textContent?.includes(label));
|
||||
}
|
||||
|
||||
export function expectBlockValue(container, label, value) {
|
||||
const block = findServiceBlockByLabel(container, label);
|
||||
expect(block, `missing block for ${label}`).toBeTruthy();
|
||||
expect(block.textContent).toContain(String(value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user