deno.land / x / ruck@v5.0.0 / TransferContext.test.mjs

TransferContext.test.mjs
// @ts-check
import { createElement as h, useContext } from "react";import { renderToStaticMarkup } from "react-dom/server";import { assertStrictEquals } from "std/testing/asserts.ts";
import TransferContext from "./TransferContext.mjs";
Deno.test("`TransferContext` used as a React context.", () => { let contextValue;
function TestComponent() { contextValue = useContext(TransferContext); return null; }
const value = /** @type {import("./serve.mjs").Transfer} */ ({});
renderToStaticMarkup( h(TransferContext.Provider, { value }, h(TestComponent)), );
assertStrictEquals(contextValue, value);});
ruck
Ruck is an open source buildless React web application framework for Deno.
GitHub Stars
74
Go to latest

Version Info

Tagged at
a month ago

External Dependencies