Skip to content

Commit 461ca5d

Browse files
committed
Even faster tests (#4868)
* Various improvements in test name / de-duplications * Reverts to class by class deletion, introduced fast mode that just delete data for mongo - Speeds up are incredible Executed 1695 of 1713 specs INCOMPLETE (18 PENDING) in 4 mins 19 secs. * Adds documentation about the deleteEverything
1 parent 305e4ba commit 461ca5d

18 files changed

+637
-640
lines changed

spec/AuthenticationAdapters.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ describe('AuthenticationProviders', function() {
301301
})
302302
});
303303

304-
it('properly loads custom adapter module object', (done) => {
304+
it('properly loads custom adapter module object (again)', (done) => {
305305
const authenticationHandler = authenticationLoader({
306306
customAuthentication: { module: path.resolve('./spec/support/CustomAuthFunction.js'), options: { token: 'valid-token' }}
307307
});

spec/HTTPRequest.spec.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,6 @@ describe("httpRequest", () => {
132132
});
133133
})
134134

135-
it("should fail on 404", (done) => {
136-
httpRequest({
137-
url: httpRequestServer + "/404",
138-
}).then(function(){
139-
fail("should not succeed");
140-
done();
141-
}, function(httpResponse){
142-
expect(httpResponse.status).toBe(404);
143-
expect(httpResponse.buffer).toEqual(new Buffer('NO'));
144-
expect(httpResponse.text).toEqual('NO');
145-
expect(httpResponse.data).toBe(undefined);
146-
done();
147-
})
148-
})
149-
150135
it("should post on echo", (done) => {
151136
let calls = 0;
152137
httpRequest({

spec/JobSchedule.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ describe('JobSchedule', () => {
5050
rp.put(Parse.serverURL + '/cloud_code/jobs/jobId', defaultOptions).then(done.fail, () => done());
5151
});
5252

53-
it('should reject access when not using masterKey (PUT /jobs/id)', (done) => {
53+
it('should reject access when not using masterKey (DELETE /jobs/id)', (done) => {
5454
rp.del(Parse.serverURL + '/cloud_code/jobs/jobId', defaultOptions).then(done.fail, () => done());
5555
});
5656

57-
it('should allow access when using masterKey (/jobs)', (done) => {
57+
it('should allow access when using masterKey (GET /jobs)', (done) => {
5858
rp.get(Parse.serverURL + '/cloud_code/jobs', masterKeyOptions).then(done, done.fail);
5959
});
6060

spec/LoggerController.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const LoggerController = require('../lib/Controllers/LoggerController').LoggerCo
22
const WinstonLoggerAdapter = require('../lib/Adapters/Logger/WinstonLoggerAdapter').WinstonLoggerAdapter;
33

44
describe('LoggerController', () => {
5-
it('can check process a query without throwing', (done) => {
5+
it('can process an empty query without throwing', (done) => {
66
// Make mock request
77
const query = {};
88

@@ -37,7 +37,7 @@ describe('LoggerController', () => {
3737
done();
3838
});
3939

40-
it('can process a query without throwing', (done) => {
40+
it('can process an ascending query without throwing', (done) => {
4141
// Make mock request
4242
const query = {
4343
from: "2016-01-01Z00:00:00",
@@ -58,7 +58,7 @@ describe('LoggerController', () => {
5858
done();
5959
});
6060

61-
it('can check process a query without throwing', (done) => {
61+
it('can process a descending query without throwing', (done) => {
6262
// Make mock request
6363
const query = {
6464
from: "2016-01-01",

spec/MongoStorageAdapter.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const databaseURI = 'mongodb://localhost:27017/parseServerMongoAdapterTestDataba
99
describe_only_db('mongo')('MongoStorageAdapter', () => {
1010
beforeEach(done => {
1111
new MongoStorageAdapter({ uri: databaseURI })
12-
.dropDatabase()
12+
.deleteAllClasses()
1313
.then(done, fail);
1414
});
1515

spec/MongoTransform.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('parseObjectToMongoObjectForCreate', () => {
2424
done();
2525
});
2626

27-
it('built-in timestamps', (done) => {
27+
it('built-in timestamps with date', (done) => {
2828
const input = {
2929
createdAt: "2015-10-06T21:24:50.332Z",
3030
updatedAt: "2015-10-06T21:24:50.332Z"

spec/ParseFile.spec.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -632,24 +632,6 @@ describe('Parse.File testing', () => {
632632
});
633633
});
634634

635-
it('fails to upload without a file name', done => {
636-
const headers = {
637-
'Content-Type': 'application/octet-stream',
638-
'X-Parse-Application-Id': 'test',
639-
'X-Parse-REST-API-Key': 'rest'
640-
};
641-
request.post({
642-
headers: headers,
643-
url: 'http://localhost:8378/1/files/',
644-
body: 'yolo',
645-
}, (error, response, body) => {
646-
expect(error).toBe(null);
647-
expect(response.statusCode).toBe(400);
648-
expect(body).toEqual('{"code":122,"error":"Filename not provided."}');
649-
done();
650-
});
651-
});
652-
653635
it('fails to delete an unkown file', done => {
654636
const headers = {
655637
'Content-Type': 'application/octet-stream',

spec/ParseHooks.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ describe('Hooks', () => {
336336
});
337337
});
338338

339-
it("should run the function on the test server", (done) => {
339+
it("should run the function on the test server (error handling)", (done) => {
340340

341341
app.post("/SomeFunctionError", function(req, res) {
342342
res.json({error: {code: 1337, error: "hacking that one!"}});

0 commit comments

Comments
 (0)