Skip to content

Commit

Permalink
Serializable test (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Sep 10, 2018
1 parent 5ac8836 commit dadb510
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/attributes/serializable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use strict";

describe("attributes/serializable", function () {

var A;

before(function () {
A = gpf.define({
$class: "A",

"[_member1]": [new gpf.attributes.Serializable({
name: "Member1",
type: gpf.serial.types.string,
required: true
})],
_member1: "0",

"[_member2]": [new gpf.attributes.Serializable({
name: "Member2"
})],
_member2: ""
});
});

describe("gpf.attributes.Serializable", function () {

it("provides serialization information on members", function () {
var attributes = gpf.attributes.get(A, gpf.attributes.Serializable),
member1 = attributes._member1[0].getProperty(),
member2 = attributes._member2[0].getProperty();
assert(member1.name === "Member1");
assert(member1.type === gpf.serial.types.string);
assert(member1.required);
assert(member2.name === "Member2");
assert(member2.type === gpf.serial.types.string);
assert(!member2.required);
});

});

});

0 comments on commit dadb510

Please sign in to comment.