Skip to content

Commit a1c6d41

Browse files
committed
integration test
1 parent 2710312 commit a1c6d41

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

integration/test/ParseQueryTest.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,30 @@ describe('Parse Query', () => {
4848
.catch(done.fail);
4949
});
5050

51+
it('can return raw json from queries', async () => {
52+
const object = new TestObject({ foo: 'bar' });
53+
await object.save();
54+
55+
const query = new Parse.Query(TestObject);
56+
const results = await query.find({ json: true });
57+
assert.strictEqual(results[0] instanceof Parse.Object, false);
58+
assert.strictEqual(results[0].foo, 'bar');
59+
assert.strictEqual(results[0].className, 'TestObject');
60+
assert.strictEqual(results[0].objectId, object.id);
61+
62+
let result = await query.first({ json: true });
63+
assert.strictEqual(result instanceof Parse.Object, false);
64+
assert.strictEqual(result.foo, 'bar');
65+
assert.strictEqual(result.className, 'TestObject');
66+
assert.strictEqual(result.objectId, object.id);
67+
68+
result = await query.get(object.id, { json: true });
69+
assert.strictEqual(result instanceof Parse.Object, false);
70+
assert.strictEqual(result.foo, 'bar');
71+
assert.strictEqual(result.className, 'TestObject');
72+
assert.strictEqual(result.objectId, object.id);
73+
});
74+
5175
it('can do query with count', async () => {
5276
const items = [];
5377
for (let i = 0; i < 4; i++) {

0 commit comments

Comments
 (0)