# test.govlab/quality/core/loaders/ecosystem.loader.test.ts

> 14 lines of code and 0 definitions.

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

Listed in [test.govlab/quality/core/loaders](https://banes-lab.com/api/source/testing/test.govlab/quality/core/loaders.md), after [test.govlab/quality/core/loaders/dependency.loader.test.ts](https://banes-lab.com/source/testing/test.govlab/quality/core/loaders/dependency.loader.test.ts.md) and before [test.govlab/quality/core/loaders/eslint.loader.test.ts](https://banes-lab.com/source/testing/test.govlab/quality/core/loaders/eslint.loader.test.ts.md).

## Contained in

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

## Source

```typescript
import { detectProfiles, loadEcosystems, loadProfiles } from "@govlab/quality/core/loaders/ecosystem.loader.ts";
import { expect, test } from "vitest";

test("loadEcosystems reads the classification, and loadProfiles keeps only the detectable ecosystems", () => {
    const ecosystems = loadEcosystems();
    const profiles = loadProfiles();
    expect(Object.keys(ecosystems).length).toBeGreaterThanOrEqual(profiles.length);
    expect(profiles.every((profile) => profile.markers.length > 0)).toBe(true);
});

test("detectProfiles finds the ecosystem whose marker file sits at the root, and nothing for no files", () => {
    expect(detectProfiles([])).toHaveLength(0);
    const [first] = loadProfiles();
    const marker = first?.markers[0] ?? "";
    expect(detectProfiles([marker]).map((profile) => profile.id)).toContain(first?.id);
});
```
