Skip to content

Commit

Permalink
Remove outdated test
Browse files Browse the repository at this point in the history
  • Loading branch information
rrousselGit committed Oct 20, 2024
1 parent 2e77b43 commit 15eb9bd
Showing 1 changed file with 0 additions and 89 deletions.
89 changes: 0 additions & 89 deletions packages/riverpod/test/framework/auto_dispose_test.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// ignore_for_file: deprecated_member_use_from_same_package

import 'package:expect_error/expect_error.dart';
import 'package:mockito/mockito.dart';
import 'package:riverpod/src/internals.dart';
import 'package:test/test.dart';

import '../utils.dart';

Future<void> main() async {
final library = await Library.parseFromStacktrace();

test(
'When a non-overridden autoDispose provider is disposed '
'and the associated ProviderContainer has a child ProviderContainer which overrides said provider, '
Expand Down Expand Up @@ -257,92 +254,6 @@ Future<void> main() async {
});
});

group(
'emits compilation error when passing an autoDispose provider to a non-autoDispose provider',
() {
test('to ref.watch', () {
expect(
library.withCode(
'''
import 'package:riverpod/riverpod.dart';
final autoDispose = Provider.autoDispose<int>((ref) => 0);
final alwaysAlive = Provider((ref) {
// expect-error: ARGUMENT_TYPE_NOT_ASSIGNABLE
ref.watch(autoDispose);
});
''',
),
compiles,
);
});

test('to ref.watch when using selectors', () {
expect(
library.withCode(
'''
import 'package:riverpod/riverpod.dart';
final autoDispose = Provider.autoDispose<int>((ref) => 0);
final alwaysAlive = Provider((ref) {
ref.watch(
// expect-error: ARGUMENT_TYPE_NOT_ASSIGNABLE
autoDispose
.select((value) => value),
);
});
''',
),
compiles,
);
});

test('to ref.listen', () {
expect(
library.withCode(
'''
import 'package:riverpod/riverpod.dart';
final autoDispose = Provider.autoDispose<int>((ref) => 0);
final alwaysAlive = Provider((ref) {
ref.listen<int>(
// expect-error: ARGUMENT_TYPE_NOT_ASSIGNABLE
autoDispose,
(prev, value) {},
);
});
''',
),
compiles,
);
});

test('to ref.listen when using selectors', () {
expect(
library.withCode(
'''
import 'package:riverpod/riverpod.dart';
final autoDispose = Provider.autoDispose<int>((ref) => 0);
final alwaysAlive = Provider((ref) {
ref.listen<int>(
// expect-error: ARGUMENT_TYPE_NOT_ASSIGNABLE
autoDispose
.select((value) => value),
(prev, value) {},
);
});
''',
),
compiles,
);
});
});

test(
'if a dependency changed, the element is still disposed, '
'but without calling ref.onDispose again', () async {
Expand Down

0 comments on commit 15eb9bd

Please sign in to comment.