-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a333164
commit d3b9053
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use strict"; | ||
|
||
describe("serial/get", function () { | ||
|
||
describe("gpf.serial.getProperties", function () { | ||
|
||
var A; | ||
|
||
before(function () { | ||
A = gpf.define({ | ||
$class: "A", | ||
|
||
"[_id]": [new gpf.attributes.Serializable({ | ||
name: "id", | ||
required: true | ||
})], | ||
_id: "", | ||
|
||
"[_name]": [new gpf.attributes.Serializable({ | ||
name: "name" | ||
})], | ||
_name: "" | ||
}); | ||
}); | ||
|
||
function _checkProperties (properties) { | ||
assert(Object.keys(properties).length === 2); | ||
assert(properties._id.name === "id"); | ||
assert(properties._name.name === "name"); | ||
} | ||
|
||
it("lists serializable properties (on class)", function () { | ||
_checkProperties(gpf.serial.get(A)); | ||
}); | ||
|
||
it("lists serializable properties (on instance)", function () { | ||
_checkProperties(gpf.serial.get(new A())); | ||
}); | ||
|
||
it("returns an empty object if no serializable attributes", function () { | ||
var properties = gpf.serial.get(new Date()); | ||
assert(Object.keys(properties).length === 0); | ||
}); | ||
|
||
}); | ||
|
||
}); |