File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1+ const chai = require ( 'chai' ) ;
2+ chai . should ( ) ;
3+
4+ module . exports = function testRender ( O ) {
5+ const jsonld = O . render ( ) ;
6+ jsonld . should . be . a ( 'string' ) ;
7+ jsonld . should . contain ( '<script type="application/ld+json">' ) ;
8+ jsonld . slice ( - parseInt ( '</script>' . length ) ) . should . equal ( '</script>' ) ;
9+ } ;
Original file line number Diff line number Diff line change 11const chai = require ( 'chai' ) ;
22const { WebSiteJsonLd, OrganizationJsonLd } = require ( '../dist' ) ;
3+ const testRender = require ( './render.test' ) ;
34
45chai . should ( ) ;
56
6- describe ( 'Schema.org ' , ( ) => {
7- it ( 'WebSite ' , async ( ) => {
7+ describe ( 'Website ' , ( ) => {
8+ it ( 'json ' , async ( ) => {
89 const org = new OrganizationJsonLd ( {
910 name : 'dyve' ,
1011 } ) ;
@@ -20,4 +21,11 @@ describe('Schema.org', () => {
2021 wb . data . should . have . property ( 'url' ) . equal ( 'https://dyve.dev' ) ;
2122 wb . withContext . should . have . property ( '@context' ) ;
2223 } ) ;
24+ it ( 'render' , async ( ) => {
25+ const wb = new WebSiteJsonLd ( {
26+ url : 'https://dyve.dev' ,
27+ description : 'first web site' ,
28+ } ) ;
29+ testRender ( wb ) ;
30+ } ) ;
2331} ) ;
You can’t perform that action at this time.
0 commit comments