# test.web/core/loaders/tree.loader.test.ts

> 18 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-web-core-loaders-tree-loader-test-ts
Source text: https://banes-lab.com/source/testing/test.web/core/loaders/tree.loader.test.ts.txt

Listed in [test.web/core/loaders](https://banes-lab.com/api/source/testing/test.web/core/loaders.md), after [test.web/core/loaders/stylesheet.fixture.ts](https://banes-lab.com/source/testing/test.web/core/loaders/stylesheet.fixture.ts.md) and before [test.web/core/loaders/walk.loader.test.ts](https://banes-lab.com/source/testing/test.web/core/loaders/walk.loader.test.ts.md).

## Contained in

- [test.web/core/loaders](https://banes-lab.com/anatomy/testing/folder-testing-test-web-core-loaders.md)

## Source

```typescript
import { TREE_TAB_HEADS, loadTreeTab, loadTreeTabs } from "@banes-lab/web/core/loaders/tree.loader.ts";
import { describe, expect, it } from "vitest";
import { ANATOMY_TREE_DECLARATIONS } from "@banes-lab/web/core/registries/anatomy.tree.registry.ts";

describe("TREE_TAB_HEADS", () => {
    it("gives every declared tree a tab head with its label and no sections yet", () => {
        expect(TREE_TAB_HEADS.map((head) => head.id)).toStrictEqual(
            ANATOMY_TREE_DECLARATIONS.map((declaration) => declaration.tab),
        );
        expect(TREE_TAB_HEADS.every((head) => head.sections.length === 0 && head.layout === "tree")).toBe(true);
    });
});

describe("loadTreeTab and loadTreeTabs", () => {
    it("loads a baked tree tab by its id and answers undefined for a tree with no baked module", async () => {
        expect(await loadTreeTab("undeclared")).toBeUndefined();
        const tabs = await loadTreeTabs();
        expect(tabs.every((tab) => TREE_TAB_HEADS.some((head) => head.id === tab.id))).toBe(true);
    });
});
```
