Fix problems with _keys in nested objects

This commit is contained in:
Florent Vilmart
2016-02-20 09:45:09 -05:00
parent eb0340585f
commit fbdd89c2d1
2 changed files with 32 additions and 5 deletions

View File

@@ -1736,4 +1736,33 @@ describe('Parse.Object testing', () => {
});
});
it("should create nested keys with _", done => {
const object = new Parse.Object("AnObject");
object.set("foo", {
"_bar": "_",
"baz_bar": 1,
"__foo_bar": true,
"_0": "underscore_zero",
"_more": {
"_nested": "key"
}
});
object.save().then( res => {
ok(res);
return res.fetch();
}).then( res => {
const foo = res.get("foo");
expect(foo["_bar"]).toEqual("_");
expect(foo["baz_bar"]).toEqual(1);
expect(foo["__foo_bar"]).toBe(true);
expect(foo["_0"]).toEqual("underscore_zero");
expect(foo["_more"]["_nested"]).toEqual("key");
done();
}).fail( err => {
console.error(err);
fail("should not fail");
done();
})
})
});