# test.govlab/docs/core/converters/package.converter.test.ts

> 29 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-docs-core-converters-package-converter-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/docs/core/converters/package.converter.test.ts.txt

Listed in [test.govlab/docs/core/converters](https://banes-lab.com/api/source/testing/test.govlab/docs/core/converters.md), after [test.govlab/docs/core/converters/markdown.converter.test.ts](https://banes-lab.com/source/testing/test.govlab/docs/core/converters/markdown.converter.test.ts.md) and before [test.govlab/docs/core/converters/system.converter.test.ts](https://banes-lab.com/source/testing/test.govlab/docs/core/converters/system.converter.test.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { scriptLifecycle } from "@govlab/docs/core/converters/package.converter.ts";

const graph = scriptLifecycle({
    build: "npm run build:frontend && npm run build:backend",
    "build:backend": "tsc -b",
    "build:frontend": "vite build",
    ci: "run-s build verify",
    dev: 'concurrently "npm run dev:vite" "npm run dev:server"',
    "dev:server": "nodemon server.js",
    "dev:vite": "vite",
    verify: "node verify.ts",
});

const linked = function linked(from: string, to: string): boolean {
    return graph.edges.some((edge) => edge.from === from && edge.to === to);
};

describe("scriptLifecycle", () => {
    it("resolves package runs, quoted sub-commands and run-all references", () => {
        expect(linked("script:build", "script:build:frontend")).toBe(true);
        expect(linked("script:build", "script:build:backend")).toBe(true);
        expect(linked("script:dev", "script:dev:vite")).toBe(true);
        expect(linked("script:dev", "script:dev:server")).toBe(true);
        expect(linked("script:ci", "script:build")).toBe(true);
        expect(linked("script:ci", "script:verify")).toBe(true);
    });

    it("resolves a file a runner executes and the tool a leaf script calls", () => {
        expect(linked("script:verify", "file:verify.ts")).toBe(true);
        expect(linked("script:build:frontend", "tool:vite")).toBe(true);
    });
});
```
