# test.web/core/converters/surface.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-core-converters-surface-converter-test-ts
Source text: https://banes-lab.com/source/testing/test.web/core/converters/surface.converter.test.ts.txt

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

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { indentOf, lineEdit, outputLines, outputRest } from "@banes-lab/web/core/converters/surface.converter.ts";

const line = function line(text: string): { changed: boolean; text: string } {
    return { changed: false, text };
};

describe("lineEdit", () => {
    it("names where the lines differ, how many are removed and which are typed in", () => {
        expect(lineEdit(["a", "b", "c"], [line("a"), line("x"), line("y"), line("c")])).toStrictEqual({
            at: 1,
            inserted: [line("x"), line("y")],
            removed: 1,
        });
        expect(lineEdit(["a"], [line("a")])).toStrictEqual({ at: 1, inserted: [], removed: 0 });
    });
});

describe("indentOf, outputRest and outputLines", () => {
    it("counts leading blanks, continues output already shown, and splits output without a trailing empty line", () => {
        expect(indentOf("    status")).toBe(4);
        expect(indentOf("status")).toBe(0);
        expect(outputRest("waiting\n", "waiting\nCHANGED\n")).toBe("CHANGED\n");
        expect(outputRest("waiting", "other")).toBeNull();
        expect(outputRest("", "anything")).toBeNull();
        expect(outputRest(undefined, "anything")).toBeNull();
        expect(outputLines("a\nb\n")).toStrictEqual(["a", "b"]);
        expect(outputLines("a")).toStrictEqual(["a"]);
    });
});
```
