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

RJS-2636: Add progress notifications and tests #6743

Merged
merged 73 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
44ab5ad
wip
kneth May 30, 2024
32d9dff
WIP: useProgress
gagik Jun 17, 2024
107149f
update realm-core
gagik Jun 19, 2024
6930006
Use main
gagik Jun 20, 2024
2c7cc43
Check sinon in CI
gagik Jun 21, 2024
3d1584f
remove beforeeach import
gagik Jun 21, 2024
b58927a
Add manual closing
gagik Jun 21, 2024
fe17f9f
Check CI fix
gagik Jun 21, 2024
f4e97be
Add better tests
gagik Jun 21, 2024
ba1dcd8
Delete
gagik Jun 21, 2024
f8ec72f
test: update flexible.ts and sync-session.ts
gagik Jun 21, 2024
967df32
Add deprecation
gagik Jun 21, 2024
e363199
test: update flexible.ts
gagik Jun 24, 2024
ffada3a
Add new tests
gagik Jun 24, 2024
6a8353d
Readd newlines
gagik Jun 24, 2024
3b54410
build: update package.json
gagik Jun 24, 2024
619bf8b
Fix
gagik Jun 24, 2024
7f14bdc
build: update package.json
gagik Jun 24, 2024
ac6b8db
build: update package.json
gagik Jun 24, 2024
0486815
Fix following tests
gagik Jun 24, 2024
7822e84
update CHANGELOG.md
gagik Jun 24, 2024
b5fc7cf
Add assert for react native compatibility
gagik Jun 24, 2024
e3bd866
Check with more proper cleanup
gagik Jun 24, 2024
e98f0a8
Check more proper cleanup
gagik Jun 24, 2024
fd55564
Add waiting
gagik Jun 24, 2024
b96df1d
Fix tests
gagik Jun 25, 2024
6f6a48c
Make tests less flakey
gagik Jun 25, 2024
eb31082
Ensure clear state always
gagik Jun 25, 2024
6fb1de4
Fix cleanup ordering for tests
gagik Jun 25, 2024
09fa80c
Remove clearing state
gagik Jun 25, 2024
abd3f2b
Skip tests and see
gagik Jun 25, 2024
ffcfb5d
Downgrade sinon to support more platforms
gagik Jun 25, 2024
7eb3be4
Fix lock file
gagik Jun 25, 2024
1a7e4f1
Unskip tests
gagik Jun 26, 2024
8ce8370
Use a timeout
gagik Jun 26, 2024
163ba76
Skip more complex tests
gagik Jun 26, 2024
dc62f95
Readd simple test
gagik Jun 26, 2024
f585b8e
Fix file and specify subscription
gagik Jun 26, 2024
49acea8
Use immediate stops
gagik Jun 26, 2024
8ee6a10
Use a different path and remove subs
gagik Jun 26, 2024
16e827b
Use a different path
gagik Jun 26, 2024
e58bc60
Move to after
gagik Jun 26, 2024
df48d07
Use sinon-chai
gagik Jun 26, 2024
c54a6b2
Do a test
gagik Jun 26, 2024
0ec4b51
Don't skip test
gagik Jun 26, 2024
76db849
Use a different user
gagik Jun 26, 2024
1b0d15a
Use one user for the test suite
gagik Jun 26, 2024
a296fab
Don't use relalmOpen
gagik Jun 26, 2024
541c7fd
Clear beforeEach
gagik Jun 26, 2024
0440497
Manual unsubscribe
gagik Jun 26, 2024
d099d8f
Fix package lock
gagik Jun 26, 2024
6e8542a
Readd tests and manually unsubscribe
gagik Jun 26, 2024
2f54e78
Comment out unreliable tests
gagik Jun 26, 2024
5e32152
Update progress listener token.
elle-j Jul 3, 2024
0eba7bc
Export and use 'isEstimateProgressNotificationCallback()'.
elle-j Jul 3, 2024
1e2f3ab
Fix 'toBindingProgressNotificationCallback()'.
elle-j Jul 3, 2024
54bf4b8
Update API docs and export new public types.
elle-j Jul 3, 2024
bf6120f
Make 'emitProgress()' a method.
elle-j Jul 3, 2024
31daca9
Fix binding to 'emitProgress()'.
elle-j Jul 3, 2024
98cef97
Allow PBS notifiers.
elle-j Jul 3, 2024
9d3e961
Linting.
elle-j Jul 3, 2024
31192ec
Update tests with 'openRealmBeforeEach()' and 'authenticateUserBefore…
elle-j Jul 3, 2024
3626323
Consistency updates.
elle-j Jul 3, 2024
2439c69
Update test assertions.
elle-j Jul 4, 2024
a368710
Add comments about flakyness.
elle-j Jul 4, 2024
832da8f
Remove explicit 'realm.close()' in tests.
elle-j Jul 4, 2024
96cf82b
Update name of token.
elle-j Jul 4, 2024
c09a6b2
Add comments.
elle-j Jul 4, 2024
a443750
Update CHANGELOG.
elle-j Jul 4, 2024
ac55fe4
Remove 'assert' library.
elle-j Jul 4, 2024
6ac8394
Linting.
elle-j Jul 4, 2024
6f3811d
Add 'util' dependency in test for 'sinon'.
elle-j Jul 4, 2024
f27fff9
Update link to preferred callback in docs.
elle-j Jul 5, 2024
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
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
## vNext (TBD)

### Deprecations
* None
* The callback for `SyncSession.addProgressNotification` taking `transferred` and `transferable` arguments is deprecated and will be removed. See **Enhancements** below for the new callback supporting both Flexible Sync and Partition-Based Sync. ([#6743](https://github.com/realm/realm-js/pull/6743))

### Enhancements
* None
* Added progress notifications support for Flexible Sync using an `estimate` as the new callback argument. The `estimate` is roughly equivalent to an estimated value of `transferred / transferable` in the deprecated Partition-Based Sync callback. ([#6743](https://github.com/realm/realm-js/pull/6743))
```typescript
realm.syncSession?.addProgressNotification(
ProgressDirection.Upload,
ProgressMode.ReportIndefinitely,
(estimate) => console.log(`progress: ${estimate}/1.0`)
);
```

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ PODS:
- React-Core
- React-jsi
- ReactTestApp-Resources (1.0.0-dev)
- RealmJS (12.11.0):
- RealmJS (12.11.1):
- React
- RNFS (2.20.0):
- React-Core
Expand Down Expand Up @@ -1448,7 +1448,7 @@ SPEC CHECKSUMS:
ReactNativeHost: a365307db1ece0c4825b9d0f8b35de1bb2a61b0a
ReactTestApp-DevSupport: 9052e9a0ba3a96a3cc574ee66c7b6089ee76b341
ReactTestApp-Resources: d200e68756fa45c648f369210bd7ee0c14759f5a
RealmJS: 5f96d3e02420b5f579296c465a437f6e20026da9
RealmJS: ecd23895a68689ce2c048d28df3d699cf76cedb7
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 348f8b538c3ed4423eb58a8e5730feec50bce372
Expand Down
7 changes: 6 additions & 1 deletion integration-tests/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
"@types/chai-as-promised": "^7.1.5",
"@types/jsrsasign": "^10.5.4",
"@types/mocha": "^10.0.0",
"@types/sinon": "9.0.5",
"@types/sinon-chai": "3.2.12",
"mocha": "^10.1.0",
"nyc": "^15.1.0",
"platform": "^1.3.6",
Expand All @@ -94,7 +96,10 @@
"chai": "4.3.6",
"chai-as-promised": "^7.1.1",
"jsrsasign": "^11.0.0",
"node-fetch": "^3.3.2"
"node-fetch": "^3.3.2",
"sinon": "9.2.4",
"sinon-chai": "3.7.0",
"util": "^0.12.5"
},
"files": [
"/src"
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/src/hooks/authenticate-user-before.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
////////////////////////////////////////////////////////////////////////////
import { Credentials } from "realm";

export function authenticateUserBefore(): void {
export function authenticateUserBefore({ reuse } = { reuse: true }): void {
before(authenticateUserBefore.name, async function (this: AppContext & Partial<UserContext>) {
this.longTimeout();
if (this.app) {
this.user = this.app.currentUser || (await this.app.logIn(Credentials.anonymous()));
this.user = this.app.currentUser || (await this.app.logIn(Credentials.anonymous(reuse)));
} else {
throw new Error("Missing app on context. Did you forget to use the importAppBefore hook?");
}
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/tests/src/setup-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ import chai from "chai";
// See https://stackoverflow.com/a/45882252
chai.config.truncateThreshold = 0;

import sinonChai from "sinon-chai";
chai.use(sinonChai);

import chaiAsPromised from "chai-as-promised";
chai.use(chaiAsPromised);

Expand Down
Loading
Loading