Skip to content

Commit 9a3d64b

Browse files
committed
test: Restore ParseCoreData session state between tests
Tests in this group mutate the singleton ParseCoreData().sessionId and were not restoring it, leaking state across cases. Capture the prior session in setUp() and restore it in tearDown() so each test starts from a known baseline. Addresses CodeRabbit nit on PR #1139.
1 parent 032a0dc commit 9a3d64b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/dart/test/src/objects/parse_user/parse_user_session_token_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ void main() {
1414

1515
group('ParseUser save()/update() — sessionToken adoption from response', () {
1616
late MockParseClient client;
17+
String? previousSessionId;
1718

1819
const String userObjectId = 'sess123';
1920
final String putPath = Uri.parse(
@@ -22,6 +23,11 @@ void main() {
2223

2324
setUp(() {
2425
client = MockParseClient();
26+
previousSessionId = ParseCoreData().sessionId;
27+
});
28+
29+
tearDown(() {
30+
ParseCoreData().sessionId = previousSessionId;
2531
});
2632

2733
test(

0 commit comments

Comments
 (0)