diff --git a/test/PrismicText.test.tsx b/test/PrismicText.test.tsx index f920be7..5450b1e 100644 --- a/test/PrismicText.test.tsx +++ b/test/PrismicText.test.tsx @@ -1,6 +1,7 @@ import test from "ava"; import * as React from "react"; import * as prismicT from "@prismicio/types"; +import * as sinon from "sinon"; import { PrismicText } from "../src"; @@ -53,3 +54,19 @@ test("returns fallback when passed empty field", (t) => { t.deepEqual(actualUndefined, expected); t.deepEqual(actualEmpty, expected); }); + +test("throws error if passed a string-based field (e.g. Key Text or Select)", (t) => { + // Used to supress logging the error in this test. + const consoleErrorStub = sinon.stub(console, "error"); + + t.throws(() => + renderJSON( + , + ), + ); + + consoleErrorStub.restore(); +});