Advancements with postgres (#2510)

* Start DB runner from tests

* Connect GridstoreAdapter only when needed

* removes unused package

* better test errors reporting

* Adds support for __op.Delete

* Better test error reporting

* Makes sure all tests can run without crashing

* Use xdescribe to skip test suite

* Removes unused dependencies

* Let volatiles classes be created with PG on start

* Do not fail if class dont exist

* adds index.spec.js to the pg suite

* Use a new config each test to prevent side effects

* Enable EmailVerificationToken specs with pg

* Makes sure failure output is not cut

* Reduces number of ignored tests in ParseObject.spec

* Inspect reconfiguration errors

* Mark GlobalConfig is incompatible with PG

- Problem is with nested updates (param.prop = value)

* PG: Nested JSON queries and updates

- Adds support for nested json and . operator queries
- Adds debug support for PG adapter
- Adds loglevel support in helper

* Enable working specs in ParseUser

* Sets default logLevel in tests to undefined

* Adds File type support, retores purchaseValidation specs

* Adds support for updating jsonb objects

- Restores PushController tests

* Proper implementation of deleteByQuery and ORs

- Adds ParseInstallation spec to the test suite

* xit only failing tests

* Nit on ParseAPI spec

* add sorting operator

* properly bound order keys

* reverts describe_only_db behavior

* Enables passing tests

* Adds basic support for relations, upsertOneObject aliased to createObject

* progress on queries options

* Fix ACL update related problems

* Creates relation tables on class creation

* Adds Relation tests

* remove flaky tests

* use promises instead of CB

* disable flaky test

* nits

* Fixes on schema spec

- Next thing is to implemenet geopoint and files correctly

* fix failues

* Basic GeoPoint support

* Adds support for $nearSphere/$maxDistance geopoint queries

* enable passing tests

* drop tables afterEach for PG, clean up relation tables too

* Better initialization/dropTables
This commit is contained in:
Florent Vilmart
2016-08-15 16:48:39 -04:00
committed by GitHub
parent 2f1ee2186b
commit c0249283ac
42 changed files with 1447 additions and 716 deletions

View File

@@ -11,9 +11,9 @@ for (var i = 0; i < str.length; i++) {
data.push(str.charCodeAt(i));
}
describe('Parse.File testing', () => {
describe('creating files', () => {
it_exclude_dbs(['postgres'])('works with Content-Type', done => {
describe_only_db('mongo')('Parse.File testing', () => {
describe_only_db('mongo')('creating files', () => {
it('works with Content-Type', done => {
var headers = {
'Content-Type': 'application/octet-stream',
'X-Parse-Application-Id': 'test',
@@ -37,7 +37,7 @@ describe('Parse.File testing', () => {
});
it_exclude_dbs(['postgres'])('works with _ContentType', done => {
it('works with _ContentType', done => {
request.post({
url: 'http://localhost:8378/1/files/file',
@@ -53,15 +53,19 @@ describe('Parse.File testing', () => {
expect(b.name).toMatch(/_file.html/);
expect(b.url).toMatch(/^http:\/\/localhost:8378\/1\/files\/test\/.*file.html$/);
request.get(b.url, (error, response, body) => {
expect(response.headers['content-type']).toMatch('^text/html');
expect(error).toBe(null);
expect(body).toEqual('<html></html>\n');
try {
expect(response.headers['content-type']).toMatch('^text/html');
expect(error).toBe(null);
expect(body).toEqual('<html></html>\n');
} catch(e) {
jfail(e);
}
done();
});
});
});
it_exclude_dbs(['postgres'])('works without Content-Type', done => {
it('works without Content-Type', done => {
var headers = {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest'
@@ -120,7 +124,11 @@ describe('Parse.File testing', () => {
url: b.url
}, (error, response, body) => {
expect(error).toBe(null);
expect(response.statusCode).toEqual(404);
try {
expect(response.statusCode).toEqual(404);
} catch(e) {
jfail(e);
}
done();
});
});
@@ -128,7 +136,7 @@ describe('Parse.File testing', () => {
});
});
it_exclude_dbs(['postgres'])('blocks file deletions with missing or incorrect master-key header', done => {
it('blocks file deletions with missing or incorrect master-key header', done => {
var headers = {
'Content-Type': 'image/jpeg',
'X-Parse-Application-Id': 'test',
@@ -173,7 +181,7 @@ describe('Parse.File testing', () => {
});
});
it_exclude_dbs(['postgres'])('handles other filetypes', done => {
it('handles other filetypes', done => {
var headers = {
'Content-Type': 'image/jpeg',
'X-Parse-Application-Id': 'test',
@@ -207,10 +215,10 @@ describe('Parse.File testing', () => {
notEqual(file.name(), "hello.txt");
done();
}
}));
}, done));
});
it_exclude_dbs(['postgres'])("save file in object", done => {
it("save file in object", done => {
var file = new Parse.File("hello.txt", data, "text/plain");
ok(!file.url());
file.save(expectSuccess({
@@ -232,12 +240,12 @@ describe('Parse.File testing', () => {
}
}));
}
}));
}, done));
}
}));
}, done));
});
it_exclude_dbs(['postgres'])("save file in object with escaped characters in filename", done => {
it("save file in object with escaped characters in filename", done => {
var file = new Parse.File("hello . txt", data, "text/plain");
ok(!file.url());
file.save(expectSuccess({
@@ -260,9 +268,9 @@ describe('Parse.File testing', () => {
}
}));
}
}));
}, done));
}
}));
}, done));
});
it_exclude_dbs(['postgres'])("autosave file in object", done => {
@@ -282,12 +290,12 @@ describe('Parse.File testing', () => {
notEqual(file.name(), "hello.txt");
done();
}
}));
}, done));
}
}));
}, done));
});
it_exclude_dbs(['postgres'])("autosave file in object in object", done => {
it("autosave file in object in object", done => {
var file = new Parse.File("hello.txt", data, "text/plain");
ok(!file.url());
@@ -311,12 +319,12 @@ describe('Parse.File testing', () => {
notEqual(file.name(), "hello.txt");
done();
}
}));
}, done));
}
}));
}, done));
});
it_exclude_dbs(['postgres'])("saving an already saved file", done => {
it("saving an already saved file", done => {
var file = new Parse.File("hello.txt", data, "text/plain");
ok(!file.url());
file.save(expectSuccess({
@@ -332,12 +340,12 @@ describe('Parse.File testing', () => {
equal(file.name(), previousName);
done();
}
}));
}, done));
}
}));
}, done));
});
it_exclude_dbs(['postgres'])("two saves at the same time", done => {
it("two saves at the same time", done => {
var file = new Parse.File("hello.txt", data, "text/plain");
var firstName;
@@ -355,7 +363,7 @@ describe('Parse.File testing', () => {
});
});
it_exclude_dbs(['postgres'])("file toJSON testing", done => {
it("file toJSON testing", done => {
var file = new Parse.File("hello.txt", data, "text/plain");
ok(!file.url());
var object = new Parse.Object("TestObject");
@@ -366,10 +374,10 @@ describe('Parse.File testing', () => {
ok(object.toJSON().file.url);
done();
}
}));
}, done));
});
it_exclude_dbs(['postgres'])("content-type used with no extension", done => {
it("content-type used with no extension", done => {
var headers = {
'Content-Type': 'text/html',
'X-Parse-Application-Id': 'test',
@@ -384,13 +392,17 @@ describe('Parse.File testing', () => {
var b = JSON.parse(body);
expect(b.name).toMatch(/\.html$/);
request.get(b.url, (error, response, body) => {
if (!response) {
fail('response should be set');
return done();
}
expect(response.headers['content-type']).toMatch(/^text\/html/);
done();
});
});
});
it_exclude_dbs(['postgres'])("filename is url encoded", done => {
it("filename is url encoded", done => {
var headers = {
'Content-Type': 'text/html',
'X-Parse-Application-Id': 'test',
@@ -488,6 +500,9 @@ describe('Parse.File testing', () => {
expect(fileAgain.name()).toEqual('meep');
expect(fileAgain.url()).toEqual('http://meep.meep');
done();
}).catch((e) => {
jfail(e);
done();
});
});
@@ -508,6 +523,9 @@ describe('Parse.File testing', () => {
'http://files.parsetfss.com/test/tfss-123.txt'
);
done();
}).catch((e) => {
jfail(e);
done();
});
});
@@ -528,10 +546,13 @@ describe('Parse.File testing', () => {
'http://files.parse.com/test/d6e80979-a128-4c57-a167-302f874700dc-123.txt'
);
done();
}).catch((e) => {
jfail(e);
done();
});
});
it_exclude_dbs(['postgres'])('supports files in objects without urls', done => {
it('supports files in objects without urls', done => {
var file = {
__type: 'File',
name: '123.txt'
@@ -545,6 +566,9 @@ describe('Parse.File testing', () => {
let fileAgain = result.get('file');
expect(fileAgain.url()).toMatch(/123.txt$/);
done();
}).catch((e) => {
jfail(e);
done();
});
});
});