Skip to content

Instantly share code, notes, and snippets.

@kahunacohen
Created October 29, 2018 09:22
Show Gist options
  • Save kahunacohen/8dc17c549c65f22284bfd7dce6164560 to your computer and use it in GitHub Desktop.
Save kahunacohen/8dc17c549c65f22284bfd7dce6164560 to your computer and use it in GitHub Desktop.
NCBI-written audit to test for meta with name="ncbi_app"
"use strict";
const Audit = require("lighthouse").Audit;
class NCBIAppAudit extends Audit {
static get meta() {
return {
id: "ncbi_app-audit",
title: 'meta name="ncbi_app" is set',
failureTitle: 'No meta name="ncbi_app" is set',
description:
'<meta name="ncbi_app" must be set to properly ping to applog',
// The name of the custom gatherer class that provides input to this audit.
requiredArtifacts: ["NCBIAppMeta"]
};
}
static audit(artifacts) {
const ret = artifacts.NCBIAppMeta;
const score = ret.name && ret.content;
return {
rawValue: score,
score: Number(score)
};
}
}
module.exports = NCBIAppAudit;
@patrickhulce
Copy link

so here it might look like const score = ret.content && ret.content.length > 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment