Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza committed Oct 25, 2023
1 parent 39c9873 commit d788f84
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions spec/MongoStorageAdapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,17 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
});
});

it('upserts with $setOnInsert', async () => {
fit('upserts with $setOnInsert', async () => {
const uuid = require('uuid');
const uuid1 = uuid.v4();
const uuid2 = uuid.v4();
const schema = {
className: 'MyClass',
fields: {
x: { type: 'Number' },
count: { type: 'Number' },
},
};
const query = {
x: 1,
};
Expand All @@ -225,7 +232,6 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
__op: 'SetOnInsert',
amount: uuid1,
},
x: 1,
count: {
__op: 'Increment',
amount: 1,
Expand All @@ -244,12 +250,18 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
update,
{ upsert: true },
);
const q = new Parse.Query('MyClass');
const docs = await q.find();
expect(docs.length).toBe(1);
expect(docs[0].id).toBe(uuid1);
expect(docs[0].get('x')).toBe(1);
expect(docs[0].get('count')).toBe(2);
// const res = await Parse.Server.database.find(
// schema.className,
// schema,
// {},
// {},
// );
// const q = new Parse.Query('MyClass');
// const docs = await q.find();
// expect(docs.length).toBe(1);
// expect(docs[0].id).toBe(uuid1);
// expect(docs[0].get('x')).toBe(1);
// expect(docs[0].get('count')).toBe(2);
});

it('handles updating a single object with array, object date', done => {
Expand Down

0 comments on commit d788f84

Please sign in to comment.