2017-03-07 22:15:53 +00:00
|
|
|
import { assert } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
|
|
|
import { Attributes } from "./";
|
2016-03-29 04:10:33 +01:00
|
|
|
|
2016-04-03 05:24:56 +01:00
|
|
|
describe("Attribute", () => {
|
2016-05-26 15:08:34 +01:00
|
|
|
describe("#constructor()", () => {
|
2016-03-29 04:10:33 +01:00
|
|
|
|
|
|
|
it("should have val as defined with populated constructor", () => {
|
2017-03-09 22:56:08 +00:00
|
|
|
const newAttrs = new Attributes({
|
|
|
|
val: "test",
|
2016-03-29 04:50:23 +01:00
|
|
|
});
|
2017-03-09 22:56:08 +00:00
|
|
|
const stringifiedJson = JSON.stringify(newAttrs);
|
|
|
|
const newJson = JSON.parse(stringifiedJson);
|
2016-05-02 22:39:03 +01:00
|
|
|
assert.equal(newJson.root.val, "test");
|
2016-03-29 04:10:33 +01:00
|
|
|
});
|
2016-03-30 03:50:53 +01:00
|
|
|
|
|
|
|
it("should have space value as defined with populated constructor", () => {
|
2017-03-09 22:56:08 +00:00
|
|
|
const newAttrs = new Attributes({
|
|
|
|
space: "spaceTest",
|
2016-03-30 03:50:53 +01:00
|
|
|
});
|
2017-03-09 22:56:08 +00:00
|
|
|
const stringifiedJson = JSON.stringify(newAttrs);
|
|
|
|
const newJson = JSON.parse(stringifiedJson);
|
2016-05-02 22:39:03 +01:00
|
|
|
assert.equal(newJson.root.space, "spaceTest");
|
2016-03-30 03:50:53 +01:00
|
|
|
});
|
2016-03-29 04:10:33 +01:00
|
|
|
});
|
2017-03-09 22:56:08 +00:00
|
|
|
});
|