Update Ember to 3.1
This commit is contained in:
@@ -1,42 +1,42 @@
|
||||
import { module, test } from 'ember-qunit';
|
||||
import { module, test } from 'qunit';
|
||||
import schemas from 'npm:kosmos-schemas';
|
||||
import tv4 from 'npm:tv4';
|
||||
import ContributionSerializer from 'kredits-web/lib/kredits/serializers/contribution';
|
||||
|
||||
module('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'
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
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 expected = {
|
||||
kind: 'design',
|
||||
description: 'New logo design',
|
||||
details: {},
|
||||
url: 'http://opensourcedesign.org',
|
||||
ipfsData: json,
|
||||
};
|
||||
assert.deepEqual(expected, deserialized);
|
||||
});
|
||||
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,53 +1,53 @@
|
||||
import { module, test } from 'ember-qunit';
|
||||
import { module, test } from 'qunit';
|
||||
import schemas from 'npm:kosmos-schemas';
|
||||
import tv4 from 'npm:tv4';
|
||||
import ContributorSerializer from 'kredits-web/lib/kredits/serializers/contributor';
|
||||
|
||||
module('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',
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
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 expected = {
|
||||
name: 'Satoshi Nakamoto',
|
||||
kind: 'person',
|
||||
github_uid: 123,
|
||||
github_username: 'therealsatoshi',
|
||||
wiki_username: 'Satoshi',
|
||||
url: undefined,
|
||||
ipfsData: json,
|
||||
};
|
||||
assert.deepEqual(expected, deserialized);
|
||||
});
|
||||
let deserialized = ContributorSerializer.deserialize(json);
|
||||
|
||||
let expected = {
|
||||
name: 'Satoshi Nakamoto',
|
||||
kind: 'person',
|
||||
github_uid: 123,
|
||||
github_username: 'therealsatoshi',
|
||||
wiki_username: 'Satoshi',
|
||||
url: undefined,
|
||||
ipfsData: json,
|
||||
};
|
||||
assert.deepEqual(expected, deserialized);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user