From 83cf68a51317dfc7011d7cfb8019ad23f0e21308 Mon Sep 17 00:00:00 2001 From: Florent Vilmart <364568+flovilmart@users.noreply.github.com> Date: Thu, 19 Jul 2018 07:05:27 +0000 Subject: [PATCH] Ensures the test suites are properly formed for vscode jasmine plugin (#4901) * Ensures the test suites are properly formed for vscode jasmine plugin * nit --- spec/CloudCode.spec.js | 2 +- spec/ParseQuery.FullTextSearch.spec.js | 4 ++-- spec/helper.js | 28 +++++++------------------- spec/schemas.spec.js | 19 ++--------------- 4 files changed, 12 insertions(+), 41 deletions(-) diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index 852b5e26..978aa9c3 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -983,7 +983,7 @@ describe('Cloud Code', () => { TODO: fix for Postgres trying to delete a field that doesn't exists doesn't play nice */ - it_exclude_dbs(['postgres'])('should fully delete objects when using `unset` with beforeSave (regression test for #1840)', done => { + it_exclude_dbs(['postgres'])('should fully delete objects when using `unset` and `set` with beforeSave (regression test for #1840)', done => { const TestObject = Parse.Object.extend('TestObject'); const BeforeSaveObject = Parse.Object.extend('BeforeSaveChanged'); diff --git a/spec/ParseQuery.FullTextSearch.spec.js b/spec/ParseQuery.FullTextSearch.spec.js index 961cc6da..eac29c92 100644 --- a/spec/ParseQuery.FullTextSearch.spec.js +++ b/spec/ParseQuery.FullTextSearch.spec.js @@ -280,7 +280,7 @@ describe('Parse.Query Full Text Search testing', () => { }); }); -describe_only_db('mongo')('Parse.Query Full Text Search testing', () => { +describe_only_db('mongo')('[mongodb] Parse.Query Full Text Search testing', () => { it('fullTextSearch: does not create text index if compound index exist', (done) => { fullTextHelper().then(() => { return databaseAdapter.dropAllIndexes('TestObject'); @@ -451,7 +451,7 @@ describe_only_db('mongo')('Parse.Query Full Text Search testing', () => { }); }); -describe_only_db('postgres')('Parse.Query Full Text Search testing', () => { +describe_only_db('postgres')('[postgres] Parse.Query Full Text Search testing', () => { it('fullTextSearch: $diacriticSensitive - false', (done) => { fullTextHelper().then(() => { const where = { diff --git a/spec/helper.js b/spec/helper.js index 800536f4..adcee449 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -411,25 +411,17 @@ global.jfail = function(err) { global.it_exclude_dbs = excluded => { if (excluded.indexOf(process.env.PARSE_SERVER_TEST_DB) >= 0) { - return (name, suite) => { - return xit(`[not on ${excluded.join(',')}] ${name}`, suite); - }; + return xit; } else { - return (name, suite) => { - return it(`[not on ${excluded.join(',')}] ${name}`, suite); - }; + return it; } } global.it_only_db = db => { if (process.env.PARSE_SERVER_TEST_DB === db || !process.env.PARSE_SERVER_TEST_DB && db == 'mongo') { - return (name, suite) => { - return it(`[${db}] ${name}`, suite); - }; + return it; } else { - return (name, suite) => { - return xit(`[${db}] ${name}`, suite); - }; + return xit; } }; @@ -443,17 +435,11 @@ global.fit_exclude_dbs = excluded => { global.describe_only_db = db => { if (process.env.PARSE_SERVER_TEST_DB == db) { - return (name, suite) => { - return describe(`[${db}] ${name}`, suite); - }; + return describe; } else if (!process.env.PARSE_SERVER_TEST_DB && db == 'mongo') { - return (name, suite) => { - return describe(`[${db}] ${name}`, suite); - }; + return describe; } else { - return (name, suite) => { - return xdescribe(`[${db}] ${name}`, suite); - }; + return xdescribe; } } diff --git a/spec/schemas.spec.js b/spec/schemas.spec.js index 8b2417fe..e8ec3de6 100644 --- a/spec/schemas.spec.js +++ b/spec/schemas.spec.js @@ -262,21 +262,6 @@ describe('schemas', () => { }); }); - it('asks for the master key if you use the rest key', done => { - request.post({ - url: 'http://localhost:8378/1/schemas', - json: true, - headers: restKeyHeaders, - body: { - className: 'MyClass', - }, - }, (error, response, body) => { - expect(response.statusCode).toEqual(403); - expect(body.error).toEqual('unauthorized: master key is required'); - done(); - }); - }); - it('sends an error if you use mismatching class names', done => { request.post({ url: 'http://localhost:8378/1/schemas/A', @@ -1248,7 +1233,7 @@ describe('schemas', () => { }) }); - it('should throw with invalid value', done => { + it('should throw if permission is number', done => { request.post({ url: 'http://localhost:8378/1/schemas/AClass', headers: masterKeyHeaders, @@ -1266,7 +1251,7 @@ describe('schemas', () => { }) }); - it('should throw with invalid value', done => { + it('should throw if permission is empty string', done => { request.post({ url: 'http://localhost:8378/1/schemas/AClass', headers: masterKeyHeaders,