UNPKG

opds-web-client

Version:
30 lines (29 loc) 1.94 kB
"use strict"; jest.autoMockOff(); var React = require("react"); var enzyme_1 = require("enzyme"); var LaneBook_1 = require("../LaneBook"); var CatalogLink_1 = require("../CatalogLink"); var book = { id: "urn:librarysimplified.org/terms/id/3M%20ID/crrmnr9", title: "The Mayan Secrets", authors: ["Clive Cussler", "Thomas Perry"], summary: "<b>Sam and Remi Fargo race for treasure—and survival—in this lightning-paced new adventure from #1<i> New York Times</i> bestselling author Clive Cussler.</b><br /><br />Husband-and-wife team Sam and Remi Fargo are in Mexico when they come upon a remarkable discovery—the mummified remainsof a man clutching an ancient sealed pot. Within the pot is a Mayan book larger than any known before.<br /><br />The book contains astonishing information about the Mayans, their cities, and about mankind itself. The secrets are so powerful that some people would do anything to possess them—as the Fargos are about to find out. Many men and women are going to die for that book.", imageUrl: "https://dlotdqc6pnwqb.cloudfront.net/3M/crrmnr9/cover.jpg", publisher: "Penguin Publishing Group" }; describe("LaneBook", function () { it("shows the book cover with empty alt", function () { var wrapper = enzyme_1.shallow(React.createElement(LaneBook_1.default, {book: book})); var coverImage = wrapper.find("img"); expect(coverImage.props().src).toBe(book.imageUrl); expect(coverImage.props().alt).toEqual(""); }); it("shows book title in a CatalogLink", function () { var wrapper = enzyme_1.shallow(React.createElement(LaneBook_1.default, {book: book})); var link = wrapper.find(CatalogLink_1.default); var title = link.find(".bookTitle"); expect(link.props().bookUrl).toBe(book.url); expect(title.text()).toBe(book.title); }); });