# test.web/core/predicates/resource.predicate.test.ts

> 14 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-web-core-predicates-resource-predicate-test-ts
Source text: https://banes-lab.com/source/testing/test.web/core/predicates/resource.predicate.test.ts.txt

Listed in [test.web/core/predicates](https://banes-lab.com/api/source/testing/test.web/core/predicates.md), after [test.web/core/predicates/link.predicate.test.ts](https://banes-lab.com/source/testing/test.web/core/predicates/link.predicate.test.ts.md) and before [test.web/core/predicates/surface.predicate.test.ts](https://banes-lab.com/source/testing/test.web/core/predicates/surface.predicate.test.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { isVector } from "@banes-lab/web/core/predicates/resource.predicate.ts";

const VECTOR_TYPE = "image/svg+xml";
const PAGE_TYPE = "text/html";

describe("isVector", () => {
    it("accepts only a successful response whose content type names a vector", () => {
        expect(isVector(new Response("<svg></svg>", { headers: { "content-type": VECTOR_TYPE }, status: 200 }))).toBe(
            true,
        );
        expect(isVector(new Response("", { headers: { "content-type": PAGE_TYPE }, status: 200 }))).toBe(false);
        expect(isVector(new Response("", { headers: { "content-type": VECTOR_TYPE }, status: 404 }))).toBe(false);
        expect(isVector(new Response("", { status: 200 }))).toBe(false);
    });
});
```
