fix tests
This commit is contained in:
@@ -3,7 +3,6 @@ analyzer:
|
|||||||
- lib/**/*.g.dart
|
- lib/**/*.g.dart
|
||||||
- lib/**/*.freezed.dart
|
- lib/**/*.freezed.dart
|
||||||
- example/*
|
- example/*
|
||||||
- test/*
|
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
- always_use_package_imports
|
- always_use_package_imports
|
||||||
|
|||||||
@@ -223,7 +223,10 @@ void main() {
|
|||||||
final mockDio = MockDio();
|
final mockDio = MockDio();
|
||||||
final mockUploader = MockAttachmentUploader();
|
final mockUploader = MockAttachmentUploader();
|
||||||
|
|
||||||
const file = AttachmentFile(path: 'filePath/fileName.pdf');
|
const file = AttachmentFile(
|
||||||
|
path: 'filePath/fileName.pdf',
|
||||||
|
size: 100,
|
||||||
|
);
|
||||||
const channelId = 'testId';
|
const channelId = 'testId';
|
||||||
const channelType = 'messaging';
|
const channelType = 'messaging';
|
||||||
|
|
||||||
@@ -262,7 +265,10 @@ void main() {
|
|||||||
final mockDio = MockDio();
|
final mockDio = MockDio();
|
||||||
final mockUploader = MockAttachmentUploader();
|
final mockUploader = MockAttachmentUploader();
|
||||||
|
|
||||||
const image = AttachmentFile(path: 'imagePath/imageName.jpeg');
|
const image = AttachmentFile(
|
||||||
|
path: 'imagePath/imageName.jpeg',
|
||||||
|
size: 100,
|
||||||
|
);
|
||||||
const channelId = 'testId';
|
const channelId = 'testId';
|
||||||
const channelType = 'messaging';
|
const channelType = 'messaging';
|
||||||
|
|
||||||
|
|||||||
@@ -861,10 +861,10 @@ void main() {
|
|||||||
DateTime.parse('2019-04-03T18:43:33.213374Z'));
|
DateTime.parse('2019-04-03T18:43:33.213374Z'));
|
||||||
expect(channelState.channel?.createdBy, isA<User>());
|
expect(channelState.channel?.createdBy, isA<User>());
|
||||||
expect(channelState.channel?.frozen, true);
|
expect(channelState.channel?.frozen, true);
|
||||||
expect(channelState.channel?.extraData!['example'], 1);
|
expect(channelState.channel?.extraData['example'], 1);
|
||||||
expect(channelState.channel?.extraData!['name'], '#dev');
|
expect(channelState.channel?.extraData['name'], '#dev');
|
||||||
expect(
|
expect(
|
||||||
channelState.channel?.extraData!['image'],
|
channelState.channel?.extraData['image'],
|
||||||
'https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png',
|
'https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png',
|
||||||
);
|
);
|
||||||
expect(channelState.messages, hasLength(25));
|
expect(channelState.messages, hasLength(25));
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ void main() {
|
|||||||
expect(channel.id, equals('test'));
|
expect(channel.id, equals('test'));
|
||||||
expect(channel.type, equals('livestream'));
|
expect(channel.type, equals('livestream'));
|
||||||
expect(channel.cid, equals('livestream:test'));
|
expect(channel.cid, equals('livestream:test'));
|
||||||
expect(channel.extraData!['cats'], equals(true));
|
expect(channel.extraData['cats'], equals(true));
|
||||||
expect(channel.extraData!['fruit'], equals(['bananas', 'apples']));
|
expect(channel.extraData['fruit'], equals(['bananas', 'apples']));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should serialize to json correctly', () {
|
test('should serialize to json correctly', () {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:rxdart/rxdart.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
import 'package:stream_chat/version.dart';
|
import 'package:stream_chat/version.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
void prepareTest() {
|
void prepareTest() {
|
||||||
// https://github.com/flutter/flutter/issues/20907
|
// https://github.com/flutter/flutter/issues/20907
|
||||||
@@ -14,10 +13,11 @@ void prepareTest() {
|
|||||||
void main() {
|
void main() {
|
||||||
prepareTest();
|
prepareTest();
|
||||||
test('stream chat version matches pubspec', () {
|
test('stream chat version matches pubspec', () {
|
||||||
final String pubspecPath = '${Directory.current.path}/pubspec.yaml';
|
final pubspecPath = '${Directory.current.path}/pubspec.yaml';
|
||||||
final String pubspec = File(pubspecPath).readAsStringSync();
|
final pubspec = File(pubspecPath).readAsStringSync();
|
||||||
final RegExp regex = RegExp('version:\s*(.*)');
|
// ignore: unnecessary_string_escapes
|
||||||
final RegExpMatch? match = regex.firstMatch(pubspec);
|
final regex = RegExp('version:\s*(.*)');
|
||||||
|
final match = regex.firstMatch(pubspec);
|
||||||
expect(match, isNotNull);
|
expect(match, isNotNull);
|
||||||
expect(PACKAGE_VERSION, match?.group(1)?.trim());
|
expect(PACKAGE_VERSION, match?.group(1)?.trim());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -168,7 +168,12 @@ void main() {
|
|||||||
// Should match with the inserted channels
|
// Should match with the inserted channels
|
||||||
final updatedChannels = await channelQueryDao.getChannels(
|
final updatedChannels = await channelQueryDao.getChannels(
|
||||||
filter: filter,
|
filter: filter,
|
||||||
sort: [SortOption('member_count', comparator: sortComparator)],
|
sort: [
|
||||||
|
SortOption(
|
||||||
|
'member_count',
|
||||||
|
comparator: sortComparator,
|
||||||
|
)
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(updatedChannels.length, insertedChannels.length);
|
expect(updatedChannels.length, insertedChannels.length);
|
||||||
|
|||||||
Reference in New Issue
Block a user