# test.build/core/factories/certificate.factory.test.ts

> 11 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-build-core-factories-certificate-factory-test-ts
Source text: https://banes-lab.com/source/testing/test.build/core/factories/certificate.factory.test.ts.txt

Listed in [test.build/core/factories](https://banes-lab.com/api/source/testing/test.build/core/factories.md), after [test.build/core/factories/browser.factory.test.ts](https://banes-lab.com/source/testing/test.build/core/factories/browser.factory.test.ts.md) and before [test.build/core/factories/reference.factory.test.ts](https://banes-lab.com/source/testing/test.build/core/factories/reference.factory.test.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { devCertificate } from "@banes-lab/build-scripts/core/factories/certificate.factory.ts";

const CERT_HEADER = "-----BEGIN CERTIFICATE-----";
const KEY_MARK = "PRIVATE KEY-----";

describe("devCertificate", () => {
    it("yields a PEM certificate and private key for the dev server", async () => {
        const { cert, key } = await devCertificate();
        expect(cert.startsWith(CERT_HEADER)).toBe(true);
        expect(key.includes(KEY_MARK)).toBe(true);
    });
});
```
