# test.content/core/loaders/strings.loader.test.ts

> 30 lines of code and 0 definitions.

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

Listed in [test.content/core/loaders](https://banes-lab.com/api/source/testing/test.content/core/loaders.md), after [test.content/core/loaders/seed.loader.test.ts](https://banes-lab.com/source/testing/test.content/core/loaders/seed.loader.test.ts.md).

## Contained in

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

## Source

```typescript
import {
    baselineTarget,
    literalsOf,
    readStringsModules,
    stringsFolders,
    toneTarget,
} from "@banes-lab/content/core/loaders/strings.loader.ts";
import { describe, expect, it } from "vitest";

const SLOT = ["$", "{A}"].join("");

describe("literalsOf", () => {
    it("reads string literals and template quasis out of a source through the parser", async () => {
        const literals = await literalsOf(`export const A = "Alpha";\nexport const B = \`Beta ${SLOT}\`;\n`);
        expect(literals).toContain("Alpha");
        expect(literals.some((text) => text.startsWith("Beta"))).toBe(true);
    });
});

describe("stringsFolders and readStringsModules", () => {
    it("finds the application member's strings folder and reads every module in it", async () => {
        expect(stringsFolders()).toHaveLength(1);
        const modules = await readStringsModules();
        expect(modules.length).toBeGreaterThan(0);
        expect(modules.every((held) => held.module.endsWith(".strings.ts"))).toBe(true);
    });
});

describe("toneTarget and baselineTarget", () => {
    it("resolve the JSON report and the generated document by key", () => {
        expect(toneTarget()).toContain("tone-baseline");
        expect(baselineTarget("x.generated.md").split("\\").join("/")).toContain("/generated/x.generated.md");
    });
});
```
