This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
βs 1,000,000+ packages pre-installed, including jest-joi
with all npm
packages installed. Try it out:
/* This demo contains a barebones test runner that emulates the basic
features of Jest. For full functionality, install `jest-joi` locally in
your project. See npmjs.com/package/jest-joi for setup instructions. */
// The following line is only for this demo βΒ don't include it in your project.
const { test, expect } = require("jest-joi").demo("runkit");
// Hit "run" below to see some results!
// You can also copy over examples from the documentation.
const Joi = require("joi");
// This one will pass! π
test("A string should match its schema", () => {
const schema = Joi.string();
const value = "Hello!";
expect(value).toMatchSchema(schema);
});
// But this one will fail π
test("An object should match its schema", () => {
const schema = { a: Joi.string() };
const value = { a: false };
expect(value).toMatchSchema(schema);
});
("See npmjs.com/package/jest-joi for more examples and setup instructions.");
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.