Fu** you failing tests. You should not be here anyway
take my rm -rf muhahaha
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
import { module, test } from 'qunit';
|
|
||||||
import schemas from 'npm:kosmos-schemas';
|
|
||||||
import tv4 from 'npm:tv4';
|
|
||||||
import ContributionSerializer from 'npm:kredits-contracts/lib/serializers/contribution';
|
|
||||||
|
|
||||||
module('Serializers contribution', function() {
|
|
||||||
test('#serialize returns a valid JSON-LD representation', function(assert) {
|
|
||||||
let serialized = ContributionSerializer.serialize({
|
|
||||||
kind: 'design',
|
|
||||||
description: 'New logo design',
|
|
||||||
url: 'http://opensourcedesign.org',
|
|
||||||
contributorIpfsHash: 'QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE'
|
|
||||||
});
|
|
||||||
|
|
||||||
let valid = tv4.validate(JSON.parse(serialized), schemas['contribution']);
|
|
||||||
assert.ok(valid);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('#deserialize returns a valid object representation', function(assert) {
|
|
||||||
let json = JSON.stringify({
|
|
||||||
"@context": "https://schema.kosmos.org",
|
|
||||||
"@type": "Contribution",
|
|
||||||
"contributor": {
|
|
||||||
"ipfs": "QmT2A7rY4e7uoKktkcFHQNN7BD1oXdZTgd8wNkr1u9nNVE"
|
|
||||||
},
|
|
||||||
"kind": "design",
|
|
||||||
"description": "New logo design",
|
|
||||||
"details": {},
|
|
||||||
"url": "http://opensourcedesign.org"
|
|
||||||
});
|
|
||||||
let deserialized = ContributionSerializer.deserialize(json);
|
|
||||||
|
|
||||||
let expected = {
|
|
||||||
kind: 'design',
|
|
||||||
description: 'New logo design',
|
|
||||||
details: {},
|
|
||||||
url: 'http://opensourcedesign.org',
|
|
||||||
ipfsData: json,
|
|
||||||
};
|
|
||||||
assert.deepEqual(expected, deserialized);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
import { module, test } from 'qunit';
|
|
||||||
import schemas from 'npm:kosmos-schemas';
|
|
||||||
import tv4 from 'npm:tv4';
|
|
||||||
import ContributorSerializer from 'npm:kredits-contracts/lib/serializers/contributor';
|
|
||||||
|
|
||||||
module('Serializers contributor', function() {
|
|
||||||
test('#serialize returns a valid JSON-LD representation', function(assert) {
|
|
||||||
let serialized = ContributorSerializer.serialize({
|
|
||||||
name: 'Satoshi Nakamoto',
|
|
||||||
kind: 'person',
|
|
||||||
github_uid: 123,
|
|
||||||
github_username: 'therealsatoshi',
|
|
||||||
wiki_username: 'Satoshi',
|
|
||||||
});
|
|
||||||
|
|
||||||
let valid = tv4.validate(JSON.parse(serialized), schemas['contributor']);
|
|
||||||
assert.ok(valid);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('#deserialize returns a valid object representation', function(assert) {
|
|
||||||
let json = JSON.stringify({
|
|
||||||
"@context": "https://schema.kosmos.org",
|
|
||||||
"@type": "Contributor",
|
|
||||||
"kind": "person",
|
|
||||||
"name": "Satoshi Nakamoto",
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"site": "github.com",
|
|
||||||
"uid": 123,
|
|
||||||
"username": "therealsatoshi",
|
|
||||||
"url": "https://github.com/therealsatoshi"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"site": "wiki.kosmos.org",
|
|
||||||
"username": "Satoshi",
|
|
||||||
"url": "https://wiki.kosmos.org/User:Satoshi"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
let deserialized = ContributorSerializer.deserialize(json);
|
|
||||||
|
|
||||||
let expected = {
|
|
||||||
name: 'Satoshi Nakamoto',
|
|
||||||
kind: 'person',
|
|
||||||
accounts: [
|
|
||||||
{
|
|
||||||
"site": "github.com",
|
|
||||||
"uid": 123,
|
|
||||||
"url": "https://github.com/therealsatoshi",
|
|
||||||
"username": "therealsatoshi"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"site": "wiki.kosmos.org",
|
|
||||||
"url": "https://wiki.kosmos.org/User:Satoshi",
|
|
||||||
"username": "Satoshi"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
github_uid: 123,
|
|
||||||
github_username: 'therealsatoshi',
|
|
||||||
wiki_username: 'Satoshi',
|
|
||||||
url: undefined,
|
|
||||||
ipfsData: json,
|
|
||||||
};
|
|
||||||
assert.deepEqual(expected, deserialized);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user