2016-11-24 01:50:57 +03:00
|
|
|
import {describe, it} from 'mocha';
|
2017-05-29 21:50:03 +03:00
|
|
|
import {expect} from 'chai';
|
2016-11-24 01:50:57 +03:00
|
|
|
import {setupTest} from 'ember-mocha';
|
2016-09-26 16:04:20 +03:00
|
|
|
|
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-09-26 16:04:20 +03:00
|
|
|
|
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-09-26 16:04:20 +03:00
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|