Skip to content
This repository has been archived by the owner on May 7, 2018. It is now read-only.

Commit

Permalink
Passing naive test
Browse files Browse the repository at this point in the history
  • Loading branch information
baisong committed Mar 7, 2016
1 parent 9bacc0d commit 4ccec4c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
16 changes: 9 additions & 7 deletions test/errors.test.js
Expand Up @@ -560,10 +560,8 @@ test('getAssertionGuid', function (t) {
});
});
});

});


test('Extensions', function (t) {
t.test('no errors', function (t) {
const extension = generators['1.1.0-extension']();
Expand All @@ -572,20 +570,24 @@ test('Extensions', function (t) {
});
const badge = generators['1.1.0-badge']();
const issuer = generators['1.1.0-issuer']();
const context = generators['1.1.0-extension-context']();
const schema = generators['1.1.0-extension-schema']();
httpScope()
.get('/').reply(200, 'root')
.get('/assertion').reply(200, JSON.stringify(assertion))
.get('/badge').reply(200, JSON.stringify(badge))
.get('/issuer').reply(200, JSON.stringify(issuer))
.get('/MyExtension/schema.json').reply(200, JSON.stringify(schema))
.get('/MyExtension/context.json').reply(200, JSON.stringify(context))
.get('/1.1/assertion').reply(200, JSON.stringify(assertion))
.get('/1.1/badge').reply(200, JSON.stringify(badge))
.get('/1.1/issuer').reply(200, JSON.stringify(issuer))
.get('/1.1/MyExtension/schema.json').reply(200, JSON.stringify(schema))
.get('/1.1/MyExtension/context.json').reply(200, JSON.stringify(context))
.get('/assertion-image').reply(200, 'assertion-image', {'content-type': 'image/png'})
.get('/badge-image').reply(200, 'badge-image', {'content-type': 'image/png'})
.get('/issuer-image').reply(200, 'issuer-image')
.get('/evidence').reply(200, 'evidence')
.get('/criteria').reply(200, 'criteria')
.get('/revocation-list').reply(200, '{"found":true}')
validator(assertion, function(err, data) {
t.notOk(err, 'no error messages');
console.log(err);
t.end();
});
});
Expand Down
20 changes: 10 additions & 10 deletions test/test-generators.js
Expand Up @@ -184,8 +184,8 @@ module.exports = {
},
'1.1.0-extension': function (replacements) {
return replaceAll({
'@context': '/MyExtension/context.json',
type: ['Extension', 'extensions:MyExtension']
'@context': 'http://example.org/1.1/MyExtension/context.json',
type: ['Extension', 'extensions:MyExtension'],
myBoolean: true,
myInteger: 2,
myString: 'foo',
Expand All @@ -200,12 +200,12 @@ module.exports = {
"@context": {
"obi": "https://w3id.org/openbadges#",
"extensions": "https://example.org/",
"url": "extensions:MyExtension/context.json",
"url": "extensions:1.1/MyExtension/context.json",
},
"obi:validation": [
{
"obi:validatesType": "extensions:MyExtension",
"obi:validationSchema": "extensions:MyExtension/schema.json"
"obi:validationSchema": "extensions:1.1/MyExtension/schema.json"
}
]
}, replacements)
Expand All @@ -218,23 +218,23 @@ module.exports = {
"type": "object",
"properties": {
"myBoolean": {
"type": "boolean",
"type": "boolean"
},
"myInteger": {
"type": "integer",
"type": "integer"
},
"myString": {
"type": "string",
"type": "string"
},
"myObject" {
"myObject": {
"type": "object"
},
"myOptionalString" {
"myOptionalString": {
"type": "string"
}
},
"required": ["myBoolean", "myInteger", "myString", "myObject"]
}, replacements),
}, replacements)
}
};

Expand Down

0 comments on commit 4ccec4c

Please sign in to comment.