Ghost/ghost/admin/tests/unit/transforms/json-string-test.js

24 lines
782 B
JavaScript
Raw Normal View History

2016-11-24 01:50:57 +03:00
import {describe, it} from 'mocha';
import {expect} from 'chai';
2016-11-24 01:50:57 +03:00
import {setupTest} from 'ember-mocha';
2016-11-24 01:50:57 +03:00
describe('Unit: Transform: json-string', function() {
setupTest('transform:json-string', {});
it('exists', function() {
let transform = this.subject();
expect(transform).to.be.ok;
});
2016-11-24 01:50:57 +03:00
it('serialises an Object to a JSON String', function() {
let transform = this.subject();
let obj = {one: 'one', two: 'two'};
expect(transform.serialize(obj)).to.equal(JSON.stringify(obj));
});
2016-11-24 01:50:57 +03:00
it('deserialises a JSON String to an Object', function() {
let transform = this.subject();
let obj = {one: 'one', two: 'two'};
expect(transform.deserialize(JSON.stringify(obj))).to.deep.equal(obj);
});
});