const { string } = require("yup");
const fruits = ["banana", "apple"];
const nullable = string().oneOf(fruits).nullable();
const withNull = string().oneOf([...fruits, null]);
const nullableWithNull = string().oneOf([...fruits, null]).nullable();
console.log({
nullable: await nullable.isValid(null),
withNull: await withNull.isValid(null),
nullableWithNull: await nullableWithNull.isValid(null)
});