fix models
This commit is contained in:
@@ -168,7 +168,8 @@ void main() {
|
||||
requestOptions: FakeRequestOptions(),
|
||||
));
|
||||
|
||||
await channelClient.sendAction(Message.temp(id: 'messageid', text: ''), data);
|
||||
await channelClient.sendAction(
|
||||
Message.temp(id: 'messageid', text: ''), data);
|
||||
|
||||
verify(() => mockDio.post<String>('/messages/messageid/action', data: {
|
||||
'id': 'testid',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('src/api/requests', () {
|
||||
@@ -14,7 +14,6 @@ void main() {
|
||||
final j = option.toJson();
|
||||
expect(j, containsPair('limit', 10));
|
||||
expect(j, containsPair('offset', 0));
|
||||
expect(j, contains('hash_code'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('should connect with correct parameters', () async {
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
user: User.temp(id: 'testid'),
|
||||
@@ -73,7 +73,7 @@ void main() {
|
||||
|
||||
test('should connect with correct parameters and handle events', () async {
|
||||
final handleFunc = MockFunctions().handleFunc;
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
user: User.temp(id: 'testid'),
|
||||
@@ -92,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) {
|
||||
@@ -109,7 +109,7 @@ void main() {
|
||||
|
||||
test('should close correctly the controller', () async {
|
||||
final handleFunc = MockFunctions().handleFunc;
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
user: User.temp(id: 'testid'),
|
||||
@@ -128,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) {
|
||||
@@ -146,7 +146,7 @@ void main() {
|
||||
test('should close correctly the controller while connecting', () async {
|
||||
final handleFunc = MockFunctions().handleFunc;
|
||||
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
@@ -181,7 +181,7 @@ void main() {
|
||||
|
||||
test('should run correctly health check', () async {
|
||||
final handleFunc = MockFunctions().handleFunc;
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
user: User.temp(id: 'testid'),
|
||||
@@ -206,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 {
|
||||
@@ -225,7 +225,7 @@ void main() {
|
||||
|
||||
test('should run correctly reconnection check', () async {
|
||||
final handleFunc = MockFunctions().handleFunc;
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
Logger.root.level = Level.ALL;
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
@@ -247,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();
|
||||
@@ -270,7 +270,7 @@ void main() {
|
||||
|
||||
test('should close correctly the controller', () async {
|
||||
final handleFunc = MockFunctions().handleFunc;
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
user: User.temp(id: 'testid'),
|
||||
@@ -290,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 {
|
||||
@@ -307,7 +307,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('should throw an error', () async {
|
||||
final ConnectWebSocket connectFunc = MockFunctions().connectFunc;
|
||||
final connectFunc = MockFunctions().connectFunc;
|
||||
final ws = WebSocket(
|
||||
baseUrl: 'baseurl',
|
||||
user: User.temp(id: 'testid'),
|
||||
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
expect(reaction.type, 'wow');
|
||||
expect(
|
||||
reaction.user.toJson(),
|
||||
User.temp(id:'2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
User.temp(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
'image': 'https://randomuser.me/api/portraits/women/45.jpg',
|
||||
'name': 'Daisy Morgan'
|
||||
}).toJson(),
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
messageId: '76cd8c82-b557-4e48-9d12-87995d3a0e04',
|
||||
createdAt: DateTime.parse('2020-01-28T22:17:31.108742Z'),
|
||||
type: 'wow',
|
||||
user: User.temp(id:'2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
user: User.temp(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
'image': 'https://randomuser.me/api/portraits/women/45.jpg',
|
||||
'name': 'Daisy Morgan'
|
||||
}),
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:stream_chat/src/models/user.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('src/models/user', () {
|
||||
const jsonExample = '''
|
||||
{
|
||||
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e"
|
||||
"id": "bbb19d9a-ee50-45bc-84e5-0584e79d0c9e",
|
||||
"role": "test-role"
|
||||
}
|
||||
''';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user