# test.secrets/core/predicates/environment.predicate.test.ts

> 18 lines of code and 0 definitions.

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

Listed in [test.secrets/core/predicates](https://banes-lab.com/api/source/testing/test.secrets/core/predicates.md), after [test.secrets/core/predicates/character.predicate.test.ts](https://banes-lab.com/source/testing/test.secrets/core/predicates/character.predicate.test.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { isEntryAnswer, isValueAnswer } from "@ssot/secrets/core/predicates/environment.predicate.ts";

describe("isValueAnswer", () => {
    it("accepts the vault's value answer and refuses any other answer", () => {
        expect(isValueAnswer({ answer: "value", value: "x" })).toBe(true);
        expect(isValueAnswer({ answer: "done" })).toBe(false);
        expect(isValueAnswer({ answer: "value", value: 1 })).toBe(false);
        expect(isValueAnswer(null)).toBe(false);
    });
});

describe("isEntryAnswer", () => {
    it("accepts an entry answer whose fields each carry a label", () => {
        expect(isEntryAnswer({ answer: "entry", entry: { fields: [{ label: "A", value: null }] } })).toBe(true);
        expect(isEntryAnswer({ answer: "entry", entry: { fields: [{ value: null }] } })).toBe(false);
        expect(isEntryAnswer({ answer: "entry", entry: [] })).toBe(false);
        expect(isEntryAnswer({ answer: "value", value: "x" })).toBe(false);
    });
});
```
