fix(striker-ui): re-add not-blank tests to test batch builders

main
Tsu-ba-me 2 years ago
parent d8c6c2bec9
commit 0bdc5dd44e
  1. 4
      striker-ui/lib/test_input/buildDomainTestBatch.tsx
  2. 7
      striker-ui/lib/test_input/buildIPAddressTestBatch.tsx
  3. 10
      striker-ui/lib/test_input/buildIpCsvTestBatch.tsx
  4. 8
      striker-ui/lib/test_input/buildPeacefulStringTestBatch.tsx
  5. 7
      striker-ui/lib/test_input/buildUUIDTestBatch.tsx

@ -1,5 +1,6 @@
import { REP_DOMAIN } from '../consts/REG_EXP_PATTERNS';
import testNotBlank from './testNotBlank';
import { InlineMonoText } from '../../components/Text';
const buildDomainTestBatch: BuildInputTestBatchFunction = (
@ -12,6 +13,9 @@ const buildDomainTestBatch: BuildInputTestBatchFunction = (
isRequired,
onFinishBatch,
tests: [
{
test: testNotBlank,
},
{
onFailure: (...args) => {
onDomainTestFailure(

@ -1,5 +1,7 @@
import { REP_IPV4 } from '../consts/REG_EXP_PATTERNS';
import testNotBlank from './testNotBlank';
const buildIPAddressTestBatch: BuildInputTestBatchFunction = (
inputName,
onSuccess,
@ -10,10 +12,13 @@ const buildIPAddressTestBatch: BuildInputTestBatchFunction = (
isRequired,
onFinishBatch,
tests: [
{
test: testNotBlank,
},
{
onFailure: (...args) => {
onIPv4TestFailure(
`${inputName} should be a valid IPv4 address.`,
<>{inputName} should be a valid IPv4 address.</>,
...args,
);
},

@ -1,5 +1,7 @@
import { REP_IPV4_CSV } from '../consts/REG_EXP_PATTERNS';
import testNotBlank from './testNotBlank';
const buildIpCsvTestBatch: BuildInputTestBatchFunction = (
inputName,
onSuccess,
@ -10,10 +12,16 @@ const buildIpCsvTestBatch: BuildInputTestBatchFunction = (
isRequired,
onFinishBatch,
tests: [
{
test: testNotBlank,
},
{
onFailure: (...args) => {
onIpCsvTestFailure(
`${inputName} must be one or more valid IPv4 addresses separated by comma; without trailing comma.`,
<>
{inputName} must be one or more valid IPv4 addresses separated by
comma(s); without trailing comma.
</>,
...args,
);
},

@ -1,5 +1,6 @@
import { REP_PEACEFUL_STRING } from '../consts/REG_EXP_PATTERNS';
import testNotBlank from './testNotBlank';
import { InlineMonoText } from '../../components/Text';
const buildPeacefulStringTestBatch: BuildInputTestBatchFunction = (
@ -12,6 +13,13 @@ const buildPeacefulStringTestBatch: BuildInputTestBatchFunction = (
isRequired,
onFinishBatch,
tests: [
{
/**
* Not-blank test ensures no unnecessary error message is provided when
* input is not (yet) filled.
*/
test: testNotBlank,
},
{
onFailure: (...args) => {
onTestPeacefulStringFailureAppend(

@ -1,5 +1,7 @@
import { REP_UUID } from '../consts/REG_EXP_PATTERNS';
import testNotBlank from './testNotBlank';
const buildUUIDTestBatch: BuildInputTestBatchFunction = (
inputName,
onSuccess,
@ -10,9 +12,12 @@ const buildUUIDTestBatch: BuildInputTestBatchFunction = (
isRequired,
onFinishBatch,
tests: [
{
test: testNotBlank,
},
{
onFailure: (...args) => {
onUUIDTestFailure(`${inputName} must be a valid UUID.`, ...args);
onUUIDTestFailure(<>{inputName} must be a valid UUID.</>, ...args);
},
test: ({ value }) => REP_UUID.test(value as string),
},

Loading…
Cancel
Save