-
-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add CampgroundJsonLd component (#1292)
- Loading branch information
1 parent
e5e571c
commit 119f847
Showing
12 changed files
with
779 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import { assertSchema } from '@cypress/schema-tools'; | ||
import schemas from '../schemas'; | ||
|
||
describe('Campground JSON-LD', () => { | ||
it('matches schema', () => { | ||
cy.visit('http://localhost:3000/jsonld/campground'); | ||
cy.get('head script[type="application/ld+json"]').then(tags => { | ||
const jsonLD = JSON.parse(tags[0].innerHTML); | ||
console.log('jsonLD', jsonLD); | ||
assertSchema(schemas)('Campground', '1.0.0')(jsonLD); | ||
}); | ||
}); | ||
|
||
it('renders with one amenity feature', () => { | ||
cy.visit('http://localhost:3000/jsonld/campground'); | ||
cy.get('head script[type="application/ld+json"]').then(tags => { | ||
const jsonLD = JSON.parse(tags[0].innerHTML); | ||
expect(jsonLD).to.deep.equal({ | ||
'@context': 'https://schema.org', | ||
'@type': 'Campground', | ||
'@id': 'https://www.example.com/campground/rip-van-winkle-campground', | ||
name: 'Rip Van Winkle Campgrounds', | ||
description: 'Description about Rip Van Winkle Campgrounds', | ||
url: 'https://www.example.com/campground', | ||
telephone: '+18452468114', | ||
image: ['https://example.com/photos/1x1/photo.jpg'], | ||
address: { | ||
'@type': 'PostalAddress', | ||
streetAddress: '149 Blue Mountain Rd', | ||
addressLocality: 'Saugerties', | ||
addressRegion: 'NY', | ||
postalCode: '12477', | ||
addressCountry: 'US', | ||
}, | ||
geo: { | ||
'@type': 'GeoCoordinates', | ||
latitude: '42.092599', | ||
longitude: '-74.018580', | ||
}, | ||
openingHoursSpecification: [ | ||
{ | ||
opens: '09:00', | ||
closes: '17:00', | ||
dayOfWeek: [ | ||
'Monday', | ||
'Tuesday', | ||
'Wednesday', | ||
'Thursday', | ||
'Friday', | ||
'Saturday', | ||
'Sunday', | ||
], | ||
validFrom: '2019-12-23', | ||
validThrough: '2020-04-02', | ||
'@type': 'OpeningHoursSpecification', | ||
}, | ||
], | ||
petsAllowed: true, | ||
aggregateRating: { | ||
ratingValue: '5', | ||
ratingCount: '18', | ||
'@type': 'AggregateRating', | ||
}, | ||
amenityFeature: { | ||
'@type': 'LocationFeatureSpecification', | ||
name: 'Showers', | ||
value: true, | ||
}, | ||
priceRange: '$$', | ||
}); | ||
}); | ||
}); | ||
|
||
it('renders with multiple amenity features', () => { | ||
cy.visit('http://localhost:3000/jsonld/campground/multipleAmenityFeatures'); | ||
cy.get('head script[type="application/ld+json"]').then(tags => { | ||
const jsonLD = JSON.parse(tags[0].innerHTML); | ||
expect(jsonLD).to.deep.equal({ | ||
'@context': 'https://schema.org', | ||
'@type': 'Campground', | ||
'@id': 'https://www.example.com/campground/rip-van-winkle-campground', | ||
name: 'Rip Van Winkle Campgrounds', | ||
description: 'Description about Rip Van Winkle Campgrounds', | ||
url: 'https://www.example.com/campground', | ||
telephone: '+18452468114', | ||
image: ['https://example.com/photos/1x1/photo.jpg'], | ||
address: { | ||
'@type': 'PostalAddress', | ||
streetAddress: '149 Blue Mountain Rd', | ||
addressLocality: 'Saugerties', | ||
addressRegion: 'NY', | ||
postalCode: '12477', | ||
addressCountry: 'US', | ||
}, | ||
geo: { | ||
'@type': 'GeoCoordinates', | ||
latitude: '42.092599', | ||
longitude: '-74.018580', | ||
}, | ||
openingHoursSpecification: [ | ||
{ | ||
opens: '09:00', | ||
closes: '17:00', | ||
dayOfWeek: [ | ||
'Monday', | ||
'Tuesday', | ||
'Wednesday', | ||
'Thursday', | ||
'Friday', | ||
'Saturday', | ||
'Sunday', | ||
], | ||
validFrom: '2019-12-23', | ||
validThrough: '2020-04-02', | ||
'@type': 'OpeningHoursSpecification', | ||
}, | ||
], | ||
petsAllowed: true, | ||
aggregateRating: { | ||
ratingValue: '5', | ||
ratingCount: '18', | ||
'@type': 'AggregateRating', | ||
}, | ||
amenityFeature: [ | ||
{ | ||
'@type': 'LocationFeatureSpecification', | ||
name: 'Showers', | ||
value: true, | ||
}, | ||
{ | ||
'@type': 'LocationFeatureSpecification', | ||
name: 'RV Hookup', | ||
value: false, | ||
}, | ||
{ | ||
'@type': 'LocationFeatureSpecification', | ||
name: 'Campfire', | ||
value: true, | ||
}, | ||
], | ||
priceRange: '$$', | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.