Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798/** Tests for the configuration error classes. @module */
import { describe, expect, it,} from '@monochromatic-dev/module-test/ts';
import { InvalidInputsError, InvalidPatternsError,} from '../dist/final/neutral/index.mjs';
await describe({ name: '', children: [ describe({ name: InvalidInputsError.name, children: [ it({ name: 'extends TypeError so existing TypeError handlers keep working', fn: async () => { const error = new InvalidInputsError({ value: 1, },); expect(error,).toBeInstanceOf(TypeError,); expect(error,).toBeInstanceOf(Error,); }, },),
it({ name: 'carries upstream matcher inputs message text', fn: async () => { const error = new InvalidInputsError({ value: 1, },); expect(error.message,).toBe('Expected \'inputs\' to be a string or an array, but got a type of \'number\'',); }, },),
it({ name: 'carries upstream matcher inputs element message text', fn: async () => { const error = new InvalidInputsError({ element: 0, },); expect(error.message,).toBe('Expected \'inputs\' to be an array of strings, but found a type of \'number\' in the array',); }, },),
it({ name: 'names itself for readable stacks', fn: async () => { const error = new InvalidInputsError({ value: 1, },); expect(error.name,).toBe('InvalidInputsError',); }, },), ], },),
describe({ name: InvalidPatternsError.name, children: [ it({ name: 'extends TypeError so existing TypeError handlers keep working', fn: async () => { const error = new InvalidPatternsError({ value: 1, },); expect(error,).toBeInstanceOf(TypeError,); expect(error,).toBeInstanceOf(Error,); }, },),
it({ name: 'carries upstream matcher patterns message text', fn: async () => { const error = new InvalidPatternsError({ value: 1, },); expect(error.message,).toBe('Expected \'patterns\' to be a string or an array, but got a type of \'number\'',); }, },),
it({ name: 'carries upstream matcher patterns element message text', fn: async () => { const error = new InvalidPatternsError({ element: null, },); expect(error.message,).toBe('Expected \'patterns\' to be an array of strings, but found a type of \'object\' in the array',); }, },),
it({ name: 'names itself for readable stacks', fn: async () => { const error = new InvalidPatternsError({ value: 1, },); expect(error.name,).toBe('InvalidPatternsError',); }, },), ], },), ],},);