# test.web/domain/converters/coverage.converter.test.ts

> 27 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-web-domain-converters-coverage-converter-test-ts
Source text: https://banes-lab.com/source/testing/test.web/domain/converters/coverage.converter.test.ts.txt

Listed in [test.web/domain/converters](https://banes-lab.com/api/source/testing/test.web/domain/converters.md), after [test.web/domain/converters/contract.converter.test.ts](https://banes-lab.com/source/testing/test.web/domain/converters/contract.converter.test.ts.md) and before [test.web/domain/converters/evidence.converter.test.ts](https://banes-lab.com/source/testing/test.web/domain/converters/evidence.converter.test.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { coverageRow } from "@banes-lab/web/domain/converters/coverage.converter.ts";

describe("coverageRow", () => {
    it("counts every question of a collection and names its declared absences", () => {
        const entry = coverageRow({
            collection: "architecture",
            questions: [
                { answered: 3, declaredAbsent: 0, question: "evidence" },
                { answered: 4, declaredAbsent: 1, question: "authority" },
            ],
            records: 4,
        });
        expect(entry.term).toBe("Principles");
        expect(entry.description).toContain("evidence");
        expect(entry.description).toContain("authoritative side");
        expect(entry.description).toContain("1 ");
    });

    it("refuses a question it carries no label for", () => {
        expect(() =>
            coverageRow({
                collection: "architecture",
                questions: [{ answered: 1, declaredAbsent: 0, question: "ghost" }],
                records: 1,
            }),
        ).toThrow('"ghost"');
    });
});
```
