-
Notifications
You must be signed in to change notification settings - Fork 586
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
test migration: session tests #5391
test migration: session tests #5391
Conversation
3112736
to
c8de9df
Compare
cbb1ad4
to
6e58179
Compare
fa6d1fc
to
cea05ef
Compare
a5f536f
to
92dae35
Compare
PR should now contain the correct modifications 🤞 |
af83012
to
466d286
Compare
7014cf4
to
5bd19b0
Compare
5bd19b0
to
0ee1d10
Compare
integration-tests/realm-apps/with-db/services/mongodb/config.json
Outdated
Show resolved
Hide resolved
new Promise(() => { | ||
sleep(5000, false); | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to wrap this in a promise constructor.
Also, since the callback body is neither awaiting nor returning the promise, this is effectively a promise that never resolves but calls sleep
which might become an unhandled promise rejection.
new Promise(() => { | |
sleep(5000, false); | |
}), | |
sleep(5000, false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few considerations. Once resolved, LGTM
Co-authored-by: Gagik Amaryan <gagik@users.noreply.github.com>
} | ||
|
||
afterEach(async function (this: AppContext & ConversionTestContext) { | ||
const configSrc = this.currentTest?.ctx?.configSrc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there is a better way to retrieve this information / accomplish this cleanup... this seems like a rather ugly way to do so... but it does work.
Co-authored-by: Gagik Amaryan <gagik@users.noreply.github.com> Co-authored-by: gagik <me@gagik.co>
* Initial commit * Documenting guidelines for testing & refactoring accordingly (#4584) * Fixed types of openRealm * Adding documentation on the hooks * Apply suggestions from code review * Test Migration: Alias tests (#4581) * Migrate alias tests * Refactor to follow new test guidelines * Remove alias-tests from legacy test spec * Add migration tests (#5285) * Migrate set tests to integration tests (#5290) * Move list tests to ts (#5287) * move app tests to typescript (#5297) * remove mistakenly added duplicates of apps * Test Migration: Results Tests (#5325) * move mixed tests to integration tests (#5256) * Move array-buffer tests to integration tests (#5255) * use correct baseurl for tests (#5337) * migrate dictionary tests to ts (#5254) * move linking-objects tests to ts (#5268) * Test Migration: User Tests (#5324) * Test Migration: Queries test (#5299) * Test Migration: Notification Tests (#5347) * Add a debug launcher for integration tests * Fix the mongo client tests for local baas * fix queries test, make test errors more verbose * Remove Chrome Debugger and fix package-lock problems (#5403) * Pushed Chrome Debugger Removal with Lint errors (#5414) * fix the errors * Andrew/tests/fix-watch (#5412) * Initial commit * Fix watch for React Native * Remove lock files * Migrate object-tests to TS (#5348) * test migration: open-behaviour (#5365) * test migration: mixed-sync-test (#5398) * migrate encryption tests to TS (#5362) * migrate sync-based UUID, Dictionary and Set tests (#5356) * migrate realm tests to TS (#5352) there are additions to other files as well such as bson.ts, that is because the old realm.js file had som tests that made more sense elsewhere, so I've moved such tests into other fields where I thought it made more sense * migrate partition-values tests to TS (#5359) * test migration: session tests (#5391) * Fix issues with migrated integration tests, add select helper method. (#5429) * Refactored the importApp hook * Remove BSON as a dependency from tests * Fixed import app hook 🤞 * Renamed "BackingDB" to "mongodb" * Throw on app import errors * Delete the app on failure to import * Added bundled Realm to iOS app * Updating Gemfile.lock after RN update * Increase test timeouts * fix remainder of failing integration tests (#5451) * Cleanup tests and move test-runners into install-tests * Small Fixes for Stability and Cleanup * path tests now put realms in a testFiles folder which has been added to .gitignore * path tests now delete the realms when finished * increased the longTimeout to 30 seconds as some of the migrated tests can take this long * added more `this.longTimeout` calls where appropriate * added `mongodb-realm` directory to .gitignore, which contains app configuration when importing apps * Delete dependants of `tests` and any unused files * Andrew/app-importer/rules (#5478) * Fix for applying the default rules to BaaS * Remove any other rules and apply a general rule that allows everything * Change the app importer to update the default rule * Also fix it for realm-web * Fix web tests and apply PR feedback * Update docker image for BaaS in web tests * `realm-web` importing http service fixed (#5483) * Use the "default_rule" only for mongodb services * Ensure download assisted_agg in baas test server * Fix a broken test from upgrading baas
testAddConnectionNotification() { | ||
const partition = Utils.genPartition(); | ||
let app = new Realm.App(appConfig); | ||
const credentials = Realm.Credentials.anonymous(); | ||
return app | ||
.logIn(credentials) | ||
.then((u) => { | ||
let config = getSyncConfiguration(u, partition); | ||
return Realm.open(config); | ||
}) | ||
.then((realm) => { | ||
return new Promise((resolve, reject) => { | ||
realm.syncSession.addConnectionNotification((newState, oldState) => { | ||
if ( | ||
oldState === Realm.App.Sync.ConnectionState.Connected && | ||
newState === Realm.App.Sync.ConnectionState.Disconnected | ||
) { | ||
resolve(); | ||
} | ||
}); | ||
realm.close(); | ||
}); | ||
}); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JacobOscarGunnarsson this seems to be missing from the migrated tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is also quite big meaning that there's probably a lot of tests that could be moved to separate files, I've decided to postpone it for now and focus more on just moving the tests