Skip to content

Commit ca52b2a

Browse files
author
Kasper Overgård Nielsen
authored
RDART-1034: Update realm-core to v14.7.0 (#1681)
* Update realm-core to v14.7.0 * Tweak expected error message * Update CHANGELOG * Revert "Don't downgrade xcode (#1649)" This reverts commit bcb9b22. * Update tests to match new 401 messages * Oldest version of XCode on macos-14 runner is 14.3.1
1 parent 16bc9c9 commit ca52b2a

File tree

6 files changed

+53
-14
lines changed

6 files changed

+53
-14
lines changed

.github/workflows/build-native.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ jobs:
5151
if: startsWith(matrix.build, 'android')
5252
run: echo "ANDROID_NDK=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
5353

54+
- name: Downgrade XCode for MacOS
55+
if: matrix.build == 'macos'
56+
run: sudo xcodes select 14.3.1
57+
5458
- name: Build
5559
if: steps.check-cache.outputs.cache-hit != 'true'
5660
run: |

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
## vNext (TBD)
22

33
### Enhancements
4-
* None
4+
* Nested collections have full support for automatic client reset. (Core 14.7.0)
55

66
### Fixed
77
* Private fields did not work with default values. (Issue [#1663](https://github.com/realm/realm-dart/issues/1663))
88

9+
* Having links in a nested collections would leave the file inconsistent if the top object is removed. (Core 14.7.0)
10+
11+
* Accessing App.currentUser from within a notification produced by App.switchUser() (which includes notifications for a newly logged in user) would deadlock. (Core 14.7.0)
12+
13+
* Inserting the same typed link to the same key in a dictionary more than once would incorrectly create multiple backlinks to the object. This did not appear to cause any crashes later, but would have affecting explicit backlink count queries (eg: `...@links.@count`) and possibly notifications. (Core 14.7.0)
14+
15+
916
### Compatibility
1017
* Realm Studio: 15.0.0 or later.
1118

1219
### Internal
13-
* Using Core x.y.z.
20+
* Using Core 14.7.0.
1421

1522
## 2.2.1 (2024-05-02)
1623

packages/realm_dart/test/app_test.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,19 @@ void main() {
184184
await app.deleteUser(user);
185185
expect(user.state, UserState.removed);
186186

187-
await expectLater(() => loginWithRetry(app, Credentials.emailPassword(username, strongPassword)), throws<AppException>("invalid username/password"));
187+
await expectLater(
188+
() => loginWithRetry(app, Credentials.emailPassword(username, strongPassword)),
189+
throwsA(isA<AppException>()
190+
.having((e) => e.message, 'message', equals('unauthorized'))
191+
.having((e) => e.statusCode, 'statusCode', 401)
192+
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
193+
);
188194
});
189195

190196
baasTest('Call Atlas function that does not exist', (configuration) async {
191197
final app = App(configuration);
192198
final user = await app.logIn(Credentials.anonymous());
193-
await expectLater(user.functions.call('notExisitingFunction'), throws<AppException>("function not found: 'notExisitingFunction'"));
199+
await expectLater(user.functions.call('notExisitingFunction'), throws<AppException>("function not found"));
194200
});
195201

196202
baasTest('Call Atlas function with no arguments', (configuration) async {

packages/realm_dart/test/credentials_test.dart

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ void main() {
148148
await authProvider.registerUser(username, strongPassword);
149149
await authProvider.callResetPasswordFunction(username, newPassword, functionArgs: <dynamic>['success']);
150150
await app.logIn(Credentials.emailPassword(username, newPassword));
151-
await expectLater(() => app.logIn(Credentials.emailPassword(username, strongPassword)), throws<AppException>("invalid username/password"));
151+
await expectLater(
152+
app.logIn(Credentials.emailPassword(username, strongPassword)),
153+
throwsA(isA<AppException>()
154+
.having((e) => e.message, 'message', equals('unauthorized'))
155+
.having((e) => e.statusCode, 'statusCode', 401)
156+
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
157+
);
152158
}, appName: AppName.autoConfirm);
153159

154160
baasTest('Email/Password - call reset password function with no additional arguments', (configuration) async {
@@ -157,12 +163,16 @@ void main() {
157163
const String newPassword = "!@#!DQXQWD!223eda";
158164
final authProvider = EmailPasswordAuthProvider(app);
159165
await authProvider.registerUser(username, strongPassword);
160-
await expectLater(() async {
166+
await expectLater(
161167
// Calling this function with no additional arguments fails for the test
162168
// because of the specific implementation of resetFunc in the cloud.
163169
// resetFunc returns status 'fail' in case no other status is passed.
164-
return await authProvider.callResetPasswordFunction(username, newPassword);
165-
}, throws<AppException>('failed to reset password for user "$username"'));
170+
authProvider.callResetPasswordFunction(username, newPassword),
171+
throwsA(isA<AppException>()
172+
.having((e) => e.message, 'message', contains('failed to reset password for user "$username"'))
173+
.having((e) => e.statusCode, 'statusCode', 400)
174+
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
175+
);
166176
}, appName: AppName.autoConfirm);
167177

168178
/// JWT Payload data
@@ -298,14 +308,26 @@ void main() {
298308
var token =
299309
"eyJraWQiOiIxIiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiI2MmYzOTY4ODhhZjg3MjBiMzczZmYwNmEiLCJlbWFpbCI6Indvbmdfc2lnbml0dXJlX2tleUByZWFsbS5pbyIsImlhdCI6MTY2MDE0MjIxNSwiZXhwIjo0ODEzNzQyMjE1LCJhdWQiOiJtb25nb2RiLmNvbSIsImlzcyI6Imh0dHBzOi8vcmVhbG0uaW8ifQ.Af--ZUCL_KC7lAhrD_d1lq91O7qVwu7GqXifwxKojkLCkbjmAER9K2Xa7BPO8xNstFeX8m9uBo4BCD5B6XmngSmyCj5OZWdiG5LTR_uhA3MnpqcV3Vu40K4Yx8XrjPuCL39xVPnEfPKLGz5TjEcMLa8xMPqo51byX0q3mR2eSS4w1A7c5TiTNuQ23_SCO8aK95SyXwuUmU4mH0iR4sHPtf64WyoAXkx8w5twXExzky1_h473CwtAERdMsBhwz1YzFKP0kxU31pg5SRciF5Ly66sK1fSPTMQPuVdS_wKvAYll8_trWnWS83M3_PWs4UxzOdjSpoK0uqhN-_IC38YOGg";
300310
final credentials = Credentials.jwt(token);
301-
await expectLater(() => app.logIn(credentials), throws<AppException>("crypto/rsa: verification error"));
311+
await expectLater(
312+
() => app.logIn(credentials),
313+
throwsA(isA<AppException>()
314+
.having((e) => e.message, 'message', equals('unauthorized'))
315+
.having((e) => e.statusCode, 'statusCode', 401)
316+
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
317+
);
302318
});
303319

304320
baasTest('Facebook credentials - invalid or expired token', (configuration) async {
305321
final app = App(configuration);
306322
final accessToken = 'invalid or expired token';
307323
final credentials = Credentials.facebook(accessToken);
308-
await expectLater(() => app.logIn(credentials), throws<AppException>("error fetching info from OAuth2 provider"));
324+
await expectLater(
325+
app.logIn(credentials),
326+
throwsA(isA<AppException>()
327+
.having((e) => e.message, 'message', equals('unauthorized'))
328+
.having((e) => e.statusCode, 'statusCode', 401)
329+
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
330+
);
309331
});
310332

311333
baasTest('Function credentials - wrong payload', (configuration) {

packages/realm_dart/test/user_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ void main() {
382382
await expectLater(
383383
() => app.logIn(credentials),
384384
throwsA(isA<AppException>()
385-
.having((e) => e.message, 'message', contains('invalid API key'))
385+
.having((e) => e.message, 'message', equals('unauthorized'))
386386
.having((e) => e.statusCode, 'statusCode', 401)
387387
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))));
388388

@@ -405,7 +405,7 @@ void main() {
405405
await expectLater(
406406
() => app.logIn(credentials),
407407
throwsA(isA<AppException>()
408-
.having((e) => e.message, 'message', contains('invalid API key'))
408+
.having((e) => e.message, 'message', equals('unauthorized'))
409409
.having((e) => e.statusCode, 'statusCode', 401)
410410
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))));
411411
});
@@ -452,7 +452,7 @@ void main() {
452452
await expectLater(
453453
() async => await app.logIn(credentials),
454454
throwsA(isA<AppException>()
455-
.having((e) => e.message, 'message', 'invalid API key')
455+
.having((e) => e.message, 'message', 'unauthorized')
456456
.having((e) => e.statusCode, 'statusCode', 401)
457457
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))));
458458
});

0 commit comments

Comments
 (0)