From bfa41b8f1a856a47602716e16b212e2b1bcc1a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 14 Aug 2024 11:03:36 +0800 Subject: [PATCH] test: fix test case --- tests/validate.test.tsx | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/tests/validate.test.tsx b/tests/validate.test.tsx index cd8415b5..2a9d9227 100644 --- a/tests/validate.test.tsx +++ b/tests/validate.test.tsx @@ -1045,7 +1045,7 @@ describe('Form.Validate', () => { - , + ); const { container, rerender } = render( @@ -1086,18 +1086,13 @@ describe('Form.Validate', () => { const { container } = render(
{ - if (value !== 'bamboo') { - return Promise.reject(new Error('should be ${name}!')); - } - return ''; - }, - messageVariables: { - name: 'bamboo', - }, + validator: () => Promise.reject(new Error('\\${name} should be ${name}!')), }, ]} > @@ -1108,14 +1103,6 @@ describe('Form.Validate', () => { // Wrong value await changeValue(getInput(container), 'light'); - matchError(container, 'should be bamboo!'); - - // Correct value - await changeValue(getInput(container), 'bamboo'); - matchError(container, false); - - // Escaped variable - await changeValue(getInput(container), 'should be ${name}!'); - matchError(container, 'should be ${name}!'); + matchError(container, '${name} should be bamboo!'); }); });