我正在尝试使用Yup创建一些自定义错误消息,以确定用户的电子邮件地址是否正在使用中。
我创建了以下promise来尝试捕获服务器通信错误:
.test(
{
name: 'Email Check',
test: value => {
if (value.includes("@")) {
return new Promise<yup.ValidationError>((resolve, reject) => {
let client = new Regi
我从adafruit运行MAX31855热电偶示例中得到了这个例子。但我得到的结果低于。它在我的代码上有问题,或者在设置设备上有问题。
请帮帮忙!我花了很长时间去谷歌,但找不到结果。
Internal Temp = 0.00
C = 0.00
F = 32.00
Internal Temp = 0.00
C = 0.00
F = 32.00
Internal Temp = 0.00
C = 0.00
F = 32.00
Internal Temp = 0.00
C = 0.00
F = 32.00
Here is the code
/****************************
我想向validationSchema添加一个.test()方法。该测试用于查找常见的电子邮件域拼写错误。例如,检查gmail是否拼错了"gmial“或"gnail”。 const validationSchema = Yup.object({
email: Yup.string().lowercase()
.email('You have entered an invalid email')
.required('This field is required')
.te
我得到了上面的错误。不知道这个物体发生了什么。下面是我的对象。 export const loginValidator = yup.object({
login: yup.string().when('password', {
is: (v) => v < 9999 && v > 999,
then: yup.string().required('Phone No is required').matches(phoneRegExp, 'Must be 10 digits'),
oth
我使用和yup来验证EditorState组件草案。
我假设我可以使用下面的yup测试来检查EditorState是否为空:
//Each note has a string title and a body, which is a Draft EditorState
const validationSchema = yup.object().shape({
title: yup.string(),
body: yup.object()
.test("has text", "Cannot save an empty note", (value)
我正在尝试用Yup编写一个自定义验证,以便在我的React Formik表单中使用。每当我尝试使用这个自定义验证时,我都会得到以下错误"yupError.inner is undefined“。
每当我在字符串验证上使用test()函数时,似乎就会发生这种情况。我已经附加了导致错误的一种情况。
在一个独立的文件中...
export const validate_birthday = Yup.string().required('We need your birthday to make sure it is you')
.test({
name
Yup异步验证测试被多次调用。是否有任何方法只在值发生更改时才调用test或阻止对同一值进行验证检查?
const validationSchema = yup.object().shape({
zipCode: yup.string().required()
.test('invalidZip', 'ZipCode must be valid', (value, context) => {
/**
* api call to validate zip code
我有一个表单,它有一个字段items,它用属性image和name存储一个对象数组。image属性接受一个文件,但它是可选的,name字段是必需的。
由于某些原因,当我触摸name字段时,图像字段验证就会启动,它会抛出错误"Image太大“,这可以从formik的错误对象中看到。我不明白为什么会这样。下面是组件的代码和代码框,您可以在这里查看
import React from 'react';
import { Formik, Field, FieldArray } from 'formik';
import * as Yup from 'yu
我正在尝试添加一个单元测试来验证Yup.isValid函数,但是运行后的测试用例显示错误为:Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL。即使我更改了jasmine的最小超时,也会显示相同的错误。我验证Yup模式的函数是: export const validateSchema= (
validationSchema,
data
) => {
return new Promise(async (resolve, rej