Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Bump to jasmine 5.5.0 #9453

Open
wants to merge 9 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
560 changes: 543 additions & 17 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"form-data": "4.0.1",
"graphql-tag": "2.12.6",
"husky": "9.1.7",
"jasmine": "3.5.0",
"jasmine": "5.5.0",
"jasmine-spec-reporter": "7.0.0",
"jsdoc": "4.0.4",
"jsdoc-babel": "0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion spec/CloudCodeLogger.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ describe('Cloud Code Logger', () => {
done();
})
.then(null, e => done.fail(JSON.stringify(e)));
}).pend('needs more work.....');
});

it_id('b86e8168-8370-4730-a4ba-24ca3016ad66')(it)('cloud function should obfuscate password', done => {
Parse.Cloud.define('testFunction', () => {
Expand Down
4 changes: 2 additions & 2 deletions spec/MongoStorageAdapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const fakeClient = {
// These tests are specific to the mongo storage adapter + mongo storage format
// and will eventually be moved into their own repo
describe_only_db('mongo')('MongoStorageAdapter', () => {
beforeEach(done => {
new MongoStorageAdapter({ uri: databaseURI }).deleteAllClasses().then(done, fail);
beforeEach(async () => {
await new MongoStorageAdapter({ uri: databaseURI }).deleteAllClasses();
Config.get(Parse.applicationId).schemaCache.clear();
});

Expand Down
10 changes: 3 additions & 7 deletions spec/ParseGlobalConfig.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const request = require('../lib/request');
const Config = require('../lib/Config');

describe('a GlobalConfig', () => {
beforeEach(done => {
beforeEach(async () => {
const config = Config.get('test');
const query = on_db(
'mongo',
Expand All @@ -16,7 +16,7 @@ describe('a GlobalConfig', () => {
return { objectId: '1' };
}
);
config.database.adapter
await config.database.adapter
.upsertOneObject(
'_GlobalConfig',
{
Expand All @@ -31,11 +31,7 @@ describe('a GlobalConfig', () => {
params: { companies: ['US', 'DK'], counter: 20, internalParam: 'internal' },
masterKeyOnly: { internalParam: true },
}
)
.then(done, err => {
jfail(err);
done();
});
);
});

const headers = {
Expand Down
4 changes: 2 additions & 2 deletions spec/ParseQuery.Aggregate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const get = function (url, options) {
};

describe('Parse.Query Aggregate testing', () => {
beforeEach(done => {
loadTestData().then(done, done);
beforeEach(async () => {
await loadTestData();
});

it('should only query aggregate with master key', done => {
Expand Down
3 changes: 2 additions & 1 deletion spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3663,6 +3663,7 @@ describe('Parse.User testing', () => {
});

xit('should not send a verification email if the user signed up using oauth', done => {
// 'this test fails. See: https://github.com/parse-community/parse-server/issues/5097'
let emailCalledCount = 0;
const emailAdapter = {
sendVerificationEmail: () => {
Expand Down Expand Up @@ -3691,7 +3692,7 @@ describe('Parse.User testing', () => {
done();
});
});
}).pend('this test fails. See: https://github.com/parse-community/parse-server/issues/5097');
Copy link
Member

@mtrezza mtrezza Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the combined use of xit and .pend recommended? I thought one essentially excludes the other? Should xit be it when adding pend, or is there any advantage of combining them?

Copy link
Member Author

@dplewis dplewis Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xit.pend is not a function anymore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misread the diff file. You are removing .pend, not adding it. In that case we'd loose the info why this test is disabled. Wouldn't it be better to use this syntax:

it('should not send a verification email if the user signed up using oauth', async () => {
  pending('this test fails.  See: https://github.com/parse-community/parse-server/issues/5097');
}
  • change from xit to it
  • change from chained .pend to pending() call inside test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it your way and the test failed. I added a comment so no info is lost

Copy link
Member

@mtrezza mtrezza Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reopened, just to investigate why pending didn't work. Maybe removed in jasmine 5, I'll take a look. I think there'd be a slight benefit with pending over code comments.

});

it('should be able to update user with authData passed', done => {
let objectId;
Expand Down
8 changes: 4 additions & 4 deletions spec/PublicAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ describe('public API', () => {
});

describe('public API without publicServerURL', () => {
beforeEach(done => {
reconfigureServer({ appName: 'unused' }).then(done, fail);
beforeEach(async () => {
await reconfigureServer({ appName: 'unused' });
});
it('should get 404 on verify_email', done => {
request('http://localhost:8378/1/apps/test/verify_email', (err, httpResponse) => {
Expand All @@ -137,8 +137,8 @@ describe('public API without publicServerURL', () => {
});

describe('public API supplied with invalid application id', () => {
beforeEach(done => {
reconfigureServer({ appName: 'unused' }).then(done, fail);
beforeEach(async () => {
await reconfigureServer({ appName: 'unused' });
});

it('should get 403 on verify_email', done => {
Expand Down
9 changes: 2 additions & 7 deletions spec/PurchaseValidation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ function createProduct() {
}

describe('test validate_receipt endpoint', () => {
beforeEach(done => {
createProduct()
.then(done)
.catch(function (err) {
console.error({ err });
done();
});
beforeEach(async () => {
await createProduct();
});

it('should bypass appstore validation', async () => {
Expand Down
11 changes: 4 additions & 7 deletions spec/PushController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,14 +1224,11 @@ describe('PushController', () => {
},
};

beforeEach(done => {
reconfigureServer({
beforeEach(async () => {
await reconfigureServer({
push: { adapter: pushAdapter },
})
.then(() => {
config = Config.get(Parse.applicationId);
})
.then(done, done.fail);
});
config = Config.get(Parse.applicationId);
});

it('should throw if both expiration_time and expiration_interval are set', () => {
Expand Down
4 changes: 2 additions & 2 deletions spec/RevocableSessionsUpgrade.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ function createUser() {
}

describe_only_db('mongo')('revocable sessions', () => {
beforeEach(done => {
beforeEach(async () => {
// Create 1 user with the legacy
createUser().then(done);
await createUser();
});

it('should upgrade legacy session token', done => {
Expand Down
10 changes: 5 additions & 5 deletions spec/UserPII.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ describe('Personally Identifiable Information', () => {
});

describe('with deprecated configured sensitive fields', () => {
beforeEach(done => {
return reconfigureServer({ userSensitiveFields: ['ssn', 'zip'] }).then(done);
beforeEach(async () => {
await reconfigureServer({ userSensitiveFields: ['ssn', 'zip'] });
});

it('should be able to get own PII via API with object', done => {
Expand Down Expand Up @@ -691,12 +691,12 @@ describe('Personally Identifiable Information', () => {
});

describe('with configured sensitive fields via CLP', () => {
beforeEach(done => {
reconfigureServer({
beforeEach(async () => {
await reconfigureServer({
protectedFields: {
_User: { '*': ['ssn', 'zip'], 'role:Administrator': [] },
},
}).then(done);
});
});

it('should be able to get own PII via API with object', done => {
Expand Down
Loading