Comparing version 0.0.54 to 0.0.55
{ | ||
"name": "jsonld", | ||
"version": "0.0.54", | ||
"version": "0.0.55", | ||
"description": "A JSON-LD Processor and API implementation in JavaScript.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/digitalbazaar/jsonld.js", |
@@ -21,2 +21,54 @@ /** | ||
var today = new Date(); | ||
today = today.getFullYear() + '-' + | ||
(today.getMonth() < 9 ? | ||
'0' + (today.getMonth() + 1) : today.getMonth() + 1) + '-' + | ||
(today.getDate() < 10 ? '0' + today.getDate() : today.getDate()); | ||
var earl = { | ||
'@context': { | ||
'doap': 'http://usefulinc.com/ns/doap#', | ||
'foaf': 'http://xmlns.com/foaf/0.1/', | ||
'dc': 'http://purl.org/dc/terms/', | ||
'earl': 'http://www.w3.org/ns/earl#', | ||
'xsd': 'http://www.w3.org/2001/XMLSchema#', | ||
'doap:homepage': {'@type': '@id'}, | ||
'doap:license': {'@type': '@id'}, | ||
'dc:creator': {'@type': '@id'}, | ||
'foaf:homepage': {'@type': '@id'}, | ||
'subjectOf': {'@reverse': 'earl:subject'}, | ||
'earl:assertedBy': {'@type': '@id'}, | ||
'earl:mode': {'@type': '@id'}, | ||
'earl:test': {'@type': '@id'}, | ||
'earl:outcome': {'@type': '@id'}, | ||
'dc:date': {'@type': 'xsd:date'} | ||
}, | ||
'@id': 'https://github.com/digitalbazaar/jsonld.js', | ||
'@type': [ | ||
'doap:Project', | ||
'earl:TestSubject', | ||
'earl:Software' | ||
], | ||
'doap:name': 'jsonld.js', | ||
'dc:title': 'jsonld.js', | ||
'doap:homepage': 'https://github.com/digitalbazaar/jsonld.js', | ||
'doap:license': 'https://github.com/digitalbazaar/jsonld.js/blob/master/LICENSE', | ||
'doap:description': 'A JSON-LD processor for JavaScript', | ||
'doap:programming-language': 'JavaScript', | ||
'dc:creator': 'https://github.com/dlongley', | ||
'doap:developer': { | ||
'@id': 'https://github.com/dlongley', | ||
'@type': [ | ||
'foaf:Person', | ||
'earl:Assertor' | ||
], | ||
'foaf:name': 'Dave Longley', | ||
'foaf:homepage': 'https://github.com/dlongley' | ||
}, | ||
'dc:date': { | ||
'@value': today, | ||
'@type': 'xsd:date' | ||
}, | ||
'subjectOf': [] | ||
}; | ||
function expandedEqual(x, y, isList) { | ||
@@ -80,2 +132,17 @@ if(x === y) { | ||
function check(test, expect, result, done) { | ||
var earlAssertion = null; | ||
if(test._earl) { | ||
earlAssertion = { | ||
'@type': 'earl:Assertion', | ||
'earl:assertedBy': earl['doap:developer']['@id'], | ||
'earl:mode': 'earl:automatic', | ||
'earl:test': test['@id'], | ||
'earl:result': { | ||
'@type': 'earl:TestResult', | ||
'dc:date': new Date().toISOString() | ||
} | ||
}; | ||
earl.subjectOf.push(earlAssertion); | ||
} | ||
var type = test['@type']; | ||
@@ -92,2 +159,5 @@ var expanded = ( | ||
assert.deepEqual(expect, result); | ||
if(test._earl) { | ||
earlAssertion['earl:result']['earl:outcome'] = 'earl:passed'; | ||
} | ||
done(); | ||
@@ -104,2 +174,5 @@ } | ||
//console.log(actualJson); | ||
if(test._earl) { | ||
earlAssertion['earl:result']['earl:outcome'] = 'earl:failed'; | ||
} | ||
done(ex); | ||
@@ -222,3 +295,3 @@ } | ||
'name': <test name>, | ||
'@type': ["test:TestCase", "jld:<type of test>"], | ||
'@type': ['test:TestCase', 'jld:<type of test>'], | ||
'input': <input file for test>, | ||
@@ -275,4 +348,6 @@ 'context': <context file for add context test type>, | ||
var options = {}; | ||
var idBase = ''; | ||
if(src) { | ||
options.base = src.baseIri + test.input; | ||
idBase = src.baseIri + path.basename(src._path); | ||
} | ||
@@ -285,4 +360,17 @@ var dir = src ? path.dirname(src._path) : null; | ||
if(err) { | ||
earl.subjectOf.push({ | ||
'@type': 'earl:Assertion', | ||
'earl:assertedBy': earl['doap:developer']['@id'], | ||
'earl:mode': 'earl:automatic', | ||
'earl:test': test['@id'], | ||
'earl:result': { | ||
'@type': 'earl:TestResult', | ||
'dc:date': new Date().toISOString(), | ||
'earl:outcome': 'earl:failed' | ||
} | ||
}); | ||
return done(err); | ||
} | ||
test['@id'] = idBase + test['@id']; | ||
test._earl = true; | ||
check(test, expect, result, done); | ||
@@ -428,1 +516,11 @@ }; | ||
}); | ||
// FIXME: add command line params for outputting earl report | ||
/* | ||
describe('EARL report', function() { | ||
it('should print the earl report', function(done) { | ||
fs.writeFileSync('/tmp/jsonld.js-earl.jsonld', | ||
JSON.stringify(earl, null, 2)); | ||
done(); | ||
}); | ||
});*/ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
300786
8437