Ghost/ghost/admin/tests/unit/transforms/json-string-test.js
Kevin Ansfield a85f5fae35 Switch to eslint-plugin-ghost extending plugin:ghost/ember
no issue
- fix lint errors in lib/gh-koenig
- fix ghost:base eslint errors
- update ember plugin refs, remove ember-suave plugin refs
- remove old jshint refs
- add `lint:js` script
- switch to `eslint-plugin-ghost` extending `plugin:ghost/ember`
2018-01-12 12:17:56 +00:00

25 lines
839 B
JavaScript

import {describe, it} from 'mocha';
import {expect} from 'chai';
import {setupTest} from 'ember-mocha';
describe('Unit: Transform: json-string', function () {
setupTest('transform:json-string', {});
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));
});
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);
});
it('handles deserializing a blank string', function () {
let transform = this.subject();
expect(transform.deserialize('')).to.equal(null);
});
});