added null safety for llc
This commit is contained in:
@@ -50,7 +50,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
await channelClient.sendMessage(message);
|
||||
await channelClient?.sendMessage(message);
|
||||
|
||||
verify(() =>
|
||||
mockDio.post<String>('/channels/messaging/testid/message', data: {
|
||||
@@ -80,7 +80,7 @@ void main() {
|
||||
statusCode: 200,
|
||||
requestOptions: FakeRequestOptions(),
|
||||
));
|
||||
await channelClient.watch();
|
||||
await channelClient?.watch();
|
||||
|
||||
when(
|
||||
() => mockDio.post<String>(
|
||||
@@ -95,7 +95,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
await channelClient.markRead();
|
||||
await channelClient?.markRead();
|
||||
|
||||
verify(() => mockDio.post<String>('/channels/messaging/testid/read',
|
||||
data: {})).called(1);
|
||||
@@ -124,7 +124,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
await channelClient.getReplies('messageid', pagination);
|
||||
await channelClient?.getReplies('messageid', pagination);
|
||||
|
||||
verify(() => mockDio.get<String>('/messages/messageid/replies',
|
||||
queryParameters: pagination.toJson())).called(1);
|
||||
@@ -141,7 +141,7 @@ void main() {
|
||||
httpClient: mockDio,
|
||||
tokenProvider: (_) async => '',
|
||||
);
|
||||
final channelClient = client.channel('messaging', id: 'testid');
|
||||
Channel channelClient = client.channel('messaging', id: 'testid');
|
||||
|
||||
when(() => mockDio.post<String>(
|
||||
any(),
|
||||
@@ -564,7 +564,11 @@ void main() {
|
||||
'api-key',
|
||||
httpClient: mockDio,
|
||||
tokenProvider: (_) async => '',
|
||||
)..state.user = OwnUser(id: 'test-id');
|
||||
);
|
||||
|
||||
if (client != null) {
|
||||
client.state?.user = OwnUser(id: 'test-id');
|
||||
}
|
||||
|
||||
final channelClient = client.channel('messaging', id: 'testid');
|
||||
const reactionType = 'test';
|
||||
@@ -617,7 +621,11 @@ void main() {
|
||||
'api-key',
|
||||
httpClient: mockDio,
|
||||
tokenProvider: (_) async => '',
|
||||
)..state.user = OwnUser(id: 'test-id');
|
||||
);
|
||||
|
||||
if (client != null) {
|
||||
client.state?.user = OwnUser(id: 'test-id');
|
||||
}
|
||||
|
||||
final channelClient = client.channel('messaging', id: 'testid');
|
||||
|
||||
@@ -1069,8 +1077,8 @@ void main() {
|
||||
|
||||
verify(() => mockDio.post<String>('/channels/messaging/query',
|
||||
data: options)).called(1);
|
||||
expect(channelClient.id, response.channel.id);
|
||||
expect(channelClient.cid, response.channel.cid);
|
||||
expect(channelClient.id, response?.channel?.id);
|
||||
expect(channelClient.cid, response?.channel?.cid);
|
||||
});
|
||||
|
||||
test('with id', () async {
|
||||
@@ -1706,8 +1714,8 @@ void main() {
|
||||
|
||||
verify(() => mockDio.post<String>('/channels/messaging/query',
|
||||
data: options)).called(1);
|
||||
expect(channelClient.id, response.channel.id);
|
||||
expect(channelClient.cid, response.channel.cid);
|
||||
expect(channelClient.id, response?.channel?.id);
|
||||
expect(channelClient.cid, response?.channel?.cid);
|
||||
});
|
||||
|
||||
test('watch', () async {
|
||||
@@ -2027,8 +2035,8 @@ void main() {
|
||||
|
||||
verify(() => mockDio.post<String>('/channels/messaging/query',
|
||||
data: options)).called(1);
|
||||
expect(channelClient.id, response.channel.id);
|
||||
expect(channelClient.cid, response.channel.cid);
|
||||
expect(channelClient.id, response.channel?.id);
|
||||
expect(channelClient.cid, response.channel?.cid);
|
||||
});
|
||||
|
||||
test('stopWatching', () async {
|
||||
|
||||
@@ -12,12 +12,10 @@ import 'package:web_socket_channel/web_socket_channel.dart';
|
||||
|
||||
class Functions {
|
||||
WebSocketChannel connectFunc(
|
||||
String url, {
|
||||
Iterable<String> protocols,
|
||||
Map<String, dynamic> headers,
|
||||
Duration pingInterval,
|
||||
String? url, {
|
||||
Iterable<String>? protocols,
|
||||
}) =>
|
||||
null;
|
||||
WebSocketChannel.connect(Uri());
|
||||
|
||||
void handleFunc(Event event) {}
|
||||
}
|
||||
@@ -94,7 +92,7 @@ void main() {
|
||||
when(() => mockWSChannel.sink).thenAnswer((_) => MockWSSink());
|
||||
when(() => mockWSChannel.stream).thenAnswer((_) => streamController.stream);
|
||||
|
||||
final connect = ws.connect().then((_) {
|
||||
final connect = ws.connect()?.then((_) {
|
||||
streamController.sink.add('{}');
|
||||
return Future.delayed(const Duration(milliseconds: 200));
|
||||
}).then((value) {
|
||||
@@ -130,7 +128,7 @@ void main() {
|
||||
when(() => mockWSChannel.sink).thenAnswer((_) => MockWSSink());
|
||||
when(() => mockWSChannel.stream).thenAnswer((_) => streamController.stream);
|
||||
|
||||
final connect = ws.connect().then((_) {
|
||||
final connect = ws.connect()?.then((_) {
|
||||
streamController.sink.add('{}');
|
||||
return Future.delayed(const Duration(milliseconds: 200));
|
||||
}).then((value) {
|
||||
@@ -208,7 +206,7 @@ void main() {
|
||||
(_) => streamController.sink.add('{}'),
|
||||
);
|
||||
|
||||
final connect = ws.connect().then((_) {
|
||||
final connect = ws.connect()?.then((_) {
|
||||
streamController.sink.add('{}');
|
||||
return Future.delayed(const Duration(milliseconds: 200));
|
||||
}).then((value) async {
|
||||
@@ -249,7 +247,7 @@ void main() {
|
||||
when(() => mockWSChannel.stream).thenAnswer((_) => streamController.stream);
|
||||
when(() => mockWSChannel.sink).thenReturn(mockWSSink);
|
||||
|
||||
final connect = ws.connect().then((_) {
|
||||
final connect = ws.connect()?.then((_) {
|
||||
streamController.sink.add('{}');
|
||||
streamController.close();
|
||||
streamController = StreamController<String>.broadcast();
|
||||
@@ -292,7 +290,7 @@ void main() {
|
||||
when(() => mockWSChannel.stream).thenAnswer((_) => streamController.stream);
|
||||
when(() => mockWSChannel.sink).thenReturn(mockWSSink);
|
||||
|
||||
final connect = ws.connect().then((_) {
|
||||
final connect = ws.connect()?.then((_) {
|
||||
streamController.sink.add('{}');
|
||||
return Future.delayed(const Duration(milliseconds: 200));
|
||||
}).then((value) async {
|
||||
|
||||
Reference in New Issue
Block a user