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.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384import { writeFile, } from 'node:fs/promises';
import { describe, expect, it,} from '@monochromatic-dev/module-test/ts';
import { makeTempDir, runCli,} from './test-fixtures.ts';
await describe({ name: 'built wg-allowedips input failures', children: [ it({ name: 'lets CIDR parser failure propagate before stdout', fn: async () => { await using directory = await makeTempDir(); /** Invalid allowed input path. */ const allowedPath = `${directory.path}/allowed.txt`; /** Empty disallowed input path. */ const disallowedPath = `${directory.path}/disallowed.txt`; await Promise.all([ writeFile(allowedPath, '192.0.2.1/24junk\n',), writeFile(disallowedPath, '',), ],); /** Parser-failure process result. */ const result = await runCli({ args: [ '--allowed', allowedPath, '--disallowed', disallowedPath, ], },); expect(result.exitCode,).not.toBe(0,); expect(result.stderr,).toContain('not a CIDR or IP',); expect(result.stdout,).toBe('',); }, },),
it({ name: 'fails before stdout when allowed input is empty', fn: async () => { await using directory = await makeTempDir(); /** Empty allowed input path. */ const allowedPath = `${directory.path}/allowed.txt`; /** Empty disallowed input path. */ const disallowedPath = `${directory.path}/disallowed.txt`; await Promise.all([ writeFile(allowedPath, '# no addresses\n',), writeFile(disallowedPath, '',), ],); /** Empty-allowed process result. */ const result = await runCli({ args: [ '--allowed', allowedPath, '--disallowed', disallowedPath, ], },); expect(result.exitCode,).not.toBe(0,); expect(result.stderr,).toContain('Allowed input must contain at least one address',); expect(result.stdout,).toBe('',); }, },), ],},);