mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Merge branch 'master' into develop
This commit is contained in:
commit
cc3e7063e4
4 changed files with 4165 additions and 16 deletions
|
|
@ -2,7 +2,7 @@ import renderPoster from './poster.js'
|
||||||
|
|
||||||
function renderTimestamps ( video ) {
|
function renderTimestamps ( video ) {
|
||||||
|
|
||||||
if ( video.timestamps.length > 0 ) return ''
|
if ( video.timestamps.length === 0 ) return ''
|
||||||
|
|
||||||
const timestampsForRender = video.timestamps.map( timestamp => {
|
const timestampsForRender = video.timestamps.map( timestamp => {
|
||||||
const [ minutes, seconds ] = timestamp.time.split(':')
|
const [ minutes, seconds ] = timestamp.time.split(':')
|
||||||
|
|
|
||||||
4031
package-lock.json
generated
4031
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,13 @@
|
||||||
"description": "Find out the latest app support for Apple Silicon and the Apple M1 Processor",
|
"description": "Find out the latest app support for Apple Silicon and the Apple M1 Processor",
|
||||||
"author": "Sam Carlton",
|
"author": "Sam Carlton",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"ava": {
|
||||||
|
"require": [
|
||||||
|
"esm"
|
||||||
|
]
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"test": "ava --timeout=1m --verbose",
|
||||||
"dev": "nuxt",
|
"dev": "nuxt",
|
||||||
"build": "nuxt build",
|
"build": "nuxt build",
|
||||||
"start": "nuxt start",
|
"start": "nuxt start",
|
||||||
|
|
@ -51,6 +57,7 @@
|
||||||
"@nuxt/postcss8": "^1.1.3",
|
"@nuxt/postcss8": "^1.1.3",
|
||||||
"@nuxtjs/tailwindcss": "^3.3.4",
|
"@nuxtjs/tailwindcss": "^3.3.4",
|
||||||
"autoprefixer": "^8.6.4",
|
"autoprefixer": "^8.6.4",
|
||||||
|
"ava": "^3.15.0",
|
||||||
"babel-eslint": "^8.2.1",
|
"babel-eslint": "^8.2.1",
|
||||||
"cssnano": "^4.1.10",
|
"cssnano": "^4.1.10",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
|
|
@ -60,6 +67,7 @@
|
||||||
"eslint-plugin-prettier": "2.6.2",
|
"eslint-plugin-prettier": "2.6.2",
|
||||||
"eslint-plugin-vue": "^4.0.0",
|
"eslint-plugin-vue": "^4.0.0",
|
||||||
"esm": "^3.2.25",
|
"esm": "^3.2.25",
|
||||||
|
"fast-xml-parser": "^3.19.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"nodemon": "^1.11.0",
|
"nodemon": "^1.11.0",
|
||||||
"nuxt": "^2.14.11",
|
"nuxt": "^2.14.11",
|
||||||
|
|
@ -67,6 +75,7 @@
|
||||||
"postcss-cli": "^8.3.1",
|
"postcss-cli": "^8.3.1",
|
||||||
"prettier": "1.14.3",
|
"prettier": "1.14.3",
|
||||||
"replace-css-url": "^1.2.6",
|
"replace-css-url": "^1.2.6",
|
||||||
|
"structured-data-testing-tool": "^4.5.0",
|
||||||
"tailwindcss": "^1.9.6"
|
"tailwindcss": "^1.9.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
139
test/main.js
Normal file
139
test/main.js
Normal file
|
|
@ -0,0 +1,139 @@
|
||||||
|
import { promises as fs } from 'fs'
|
||||||
|
|
||||||
|
import test from 'ava'
|
||||||
|
import parser from 'fast-xml-parser'
|
||||||
|
import { structuredDataTest } from 'structured-data-testing-tool'
|
||||||
|
import { Google, Twitter } from 'structured-data-testing-tool/presets'
|
||||||
|
|
||||||
|
// require('dotenv').config()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function testStructuredData ( options ) {
|
||||||
|
const {
|
||||||
|
pageUrls,
|
||||||
|
// Check for compliance with Google, Twitter and Facebook recommendations
|
||||||
|
presets = [
|
||||||
|
Google
|
||||||
|
],
|
||||||
|
// Check the page includes a specific Schema (see https://schema.org/docs/full.html for a list)
|
||||||
|
schemas
|
||||||
|
} = options
|
||||||
|
|
||||||
|
for ( const url of pageUrls ) {
|
||||||
|
|
||||||
|
const pagePath = `./dist${ url.pathname }/index.html`
|
||||||
|
const pageHtml = await fs.readFile( pagePath , 'utf-8' )
|
||||||
|
|
||||||
|
// https://github.com/glitchdigital/structured-data-testing-tool#api
|
||||||
|
await structuredDataTest( pageHtml , {
|
||||||
|
presets,
|
||||||
|
schemas
|
||||||
|
}).then(res => {
|
||||||
|
return res
|
||||||
|
}).catch(err => {
|
||||||
|
// console.log( 'err.res.failed', err.res.failed )
|
||||||
|
|
||||||
|
if (err.type === 'VALIDATION_FAILED') {
|
||||||
|
|
||||||
|
// t.fail( 'Some structured data tests failed.' )
|
||||||
|
const validationError = new Error( 'Some structured data tests failed.' )
|
||||||
|
|
||||||
|
validationError.failed = err.res.failed
|
||||||
|
|
||||||
|
throw validationError
|
||||||
|
|
||||||
|
// return
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error( 'Structured data testing error.', err )
|
||||||
|
})
|
||||||
|
|
||||||
|
// console.log('result', tvUrl.pathname, Object.keys( result ))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test.before(async t => {
|
||||||
|
const sitemapXml = await fs.readFile('./dist/sitemap.xml', 'utf-8')
|
||||||
|
const sitemap = parser.parse( sitemapXml )
|
||||||
|
|
||||||
|
// Store sitemap urls to context
|
||||||
|
t.context.sitemapUrls = sitemap.urlset.url.map( tag => new URL( tag.loc ) )
|
||||||
|
})
|
||||||
|
|
||||||
|
test('All Category pages have valid FAQPage structured data', async (t) => {
|
||||||
|
|
||||||
|
const categoryUrls = t.context.sitemapUrls.filter( url => url.pathname.startsWith('/kind/') )
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
await testStructuredData({
|
||||||
|
pageUrls: categoryUrls,
|
||||||
|
schemas: [ 'FAQPage' ],
|
||||||
|
presets: [
|
||||||
|
Google,
|
||||||
|
// Twitter
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
} catch ( error ) {
|
||||||
|
console.log('failed', error.failed)
|
||||||
|
t.fail( error.message )
|
||||||
|
}
|
||||||
|
|
||||||
|
t.pass()
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
test('All Device pages have valid FAQPage structured data', async (t) => {
|
||||||
|
|
||||||
|
const deviceUrls = t.context.sitemapUrls.filter( url => url.pathname.startsWith('/device/') )
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
await testStructuredData({
|
||||||
|
pageUrls: deviceUrls,
|
||||||
|
schemas: [ 'FAQPage' ],
|
||||||
|
presets: [
|
||||||
|
Google,
|
||||||
|
// Twitter
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
} catch ( error ) {
|
||||||
|
console.log('failed', error.failed)
|
||||||
|
t.fail( error.message )
|
||||||
|
}
|
||||||
|
|
||||||
|
t.pass()
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
test('All TV pages have valid VideoObject structured data', async (t) => {
|
||||||
|
|
||||||
|
const tvUrls = t.context.sitemapUrls.filter( url => url.pathname.startsWith('/tv/') )
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
await testStructuredData({
|
||||||
|
pageUrls: tvUrls,
|
||||||
|
schemas: [ 'VideoObject' ]
|
||||||
|
})
|
||||||
|
|
||||||
|
} catch ( error ) {
|
||||||
|
console.log('failed', error.failed)
|
||||||
|
t.fail( error.message )
|
||||||
|
}
|
||||||
|
|
||||||
|
t.pass()
|
||||||
|
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue