@faceteer/cdk
Version:
CDK 2.0 constructs and helpers that make composing a Lambda powered service easier.
18 lines (17 loc) • 610 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = require("./invariant");
describe('invariant', () => {
test('Throws an error when the condition is falsy', () => {
const condition = null;
expect(() => (0, invariant_1.invariant)(condition)).toThrow();
});
test('Asserts a condition when it is truthy', () => {
const result = {
success: true,
data: { message: 'ok' },
};
(0, invariant_1.invariant)(result.success);
expect(result.data).toStrictEqual({ message: 'ok' });
});
});