Skip to content
Merged

Develop #2011

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cypress/integration/contentful_banners_spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
const YAML = require('yamljs')
const utf8 = require('utf8')

const allBannersYaml = 'source/_data/banners.yml'

function emojiStrip (string, utf16Encoded = true) {
if (!utf16Encoded) {
return string.replace(/\\u[\dA-F]{8}/gi, '')
}

return string.replace(/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])/g, '')
}

describe('Contentful driven banners', () => {
it('displays all current banners with proper info', function () {
cy.task('readFileMaybe', allBannersYaml)
.then((yamlString) => {
if (typeof yamlString === 'undefined' || yamlString === null) return this.skip()

const yamlObject = YAML.parse(yamlString)
const yamlObject = YAML.parse(emojiStrip(yamlString, false))

// remove all outdated or future banners
const setMyTimezoneToDate = (date) => new Date(Date.parse(date))
Expand All @@ -35,7 +42,7 @@ describe('Contentful driven banners', () => {
.should((bannerText) => {
const yamlText = Cypress.$(banners[i].text).text().trim()

expect(utf8.encode(bannerText), `Banner #${i + 1} text is proper`).to.eq(yamlText)
expect(emojiStrip(bannerText), `Banner #${i + 1} text is proper`).to.eq(yamlText)
})

cy.wrap(banner)
Expand Down
147 changes: 137 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"execa": "2.0.3",
"fluent-ffmpeg": "2.1.2",
"fs-extra": "8.1.0",
"ggit": "2.4.11",
"ggit": "2.4.12",
"git-last": "1.2.11",
"got": "9.6.0",
"gulp": "4.0.2",
Expand Down
1 change: 0 additions & 1 deletion source/_data/podcasts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ large:
img: /img/examples/cypress-hot-sear-questions-gleb-bahmutov-test-talks.jpg

- title: "This.JavaScript: State of Testing"
url: https://www.youtube.com/watch?v=iycQpCFBASE
sourceName: This Dot
sourceUrl: https://www.thisdot.co/
date: December 18, 2018
Expand Down
Loading