import { REP_PEACEFUL_STRING } from '../consts/REG_EXP_PATTERNS';
import testNotBlank from './testNotBlank';
import { InlineMonoText } from '../../components/Text';
const buildPeacefulStringTestBatch: BuildInputTestBatchFunction = (
inputName,
onSuccess,
{ getValue } = {},
onTestPeacefulStringFailureAppend,
) => ({
defaults: { getValue, onSuccess },
tests: [
{
onFailure: (...args) => {
onTestPeacefulStringFailureAppend(
<>
{inputName} cannot contain single-quote (
), double-quote (
), slash (
), backslash (
), angle brackets (
), curly brackets (
).
>,
...args,
);
},
test: ({ value }) => REP_PEACEFUL_STRING.test(value as string),
},
{ test: testNotBlank },
],
});
export default buildPeacefulStringTestBatch;