2022-10-20 12:53:02 +02:00
|
|
|
describe("parseToProto", function() {
|
2022-10-26 21:46:14 +02:00
|
|
|
var parseToProto = require("../lib/parse-to-proto");
|
|
|
|
var proto;
|
2022-10-20 12:53:02 +02:00
|
|
|
|
|
|
|
beforeEach(function() {
|
2022-10-26 21:46:14 +02:00
|
|
|
proto = {category: "animal"};
|
2022-10-20 12:53:02 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should have category, type, name and age attribute", function() {
|
2022-10-26 21:46:14 +02:00
|
|
|
let obj = parseToProto('{"type": "cat", "name":"Mimi","age":3}', proto);
|
2022-10-20 12:53:02 +02:00
|
|
|
expect("animal").toEqual(obj.category);
|
|
|
|
expect("cat").toEqual(obj.type);
|
|
|
|
expect("Mimi").toEqual(obj.name);
|
|
|
|
expect(3).toEqual(obj.age);
|
|
|
|
});
|
2022-10-26 21:46:14 +02:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|