Make coverage visible again

This commit is contained in:
Christian Pauly 2020-05-19 09:28:13 +00:00
parent 359e03496a
commit 066221b84d
9 changed files with 77 additions and 41 deletions

3
.gitignore vendored
View file

@ -9,6 +9,9 @@
.history
.svn/
native/
test/.test_coverage.dart
coverage/
coverage_badge.svg
# IntelliJ related
*.iml

View file

@ -8,7 +8,6 @@ coverage:
- linux
stage: coverage
image: debian:testing
coverage: '/^\s+lines.+: (\d+.\d*%)/'
dependencies: []
script:
- apt update
@ -24,6 +23,10 @@ coverage:
- chmod +x ./test.sh
- su -c ./prepare.sh test
- su -c ./test.sh test
artifacts:
paths:
- coverage/
coverage_without_olm:
tags:

View file

@ -274,6 +274,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
lcov:
dependency: transitive
description:
name: lcov
url: "https://pub.dartlang.org"
source: hosted
version: "5.7.0"
logging:
dependency: transitive
description:
@ -586,6 +593,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
test_coverage:
dependency: "direct dev"
description:
name: test_coverage
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
timing:
dependency: transitive
description:

View file

@ -29,7 +29,8 @@ dependencies:
dev_dependencies:
test: ^1.0.0
test_coverage: ^0.4.1
moor_generator: ^3.0.0
build_runner: ^1.5.2
pedantic: ^1.9.0 # DO NOT UPDATE AS THIS WOULD CAUSE FLUTTER TO FAIL
pedantic: ^1.9.0
moor_ffi: ^0.5.0

View file

@ -1,2 +1,4 @@
#!/bin/sh -e
pub run test -p vm
pub run test_coverage
genhtml -o coverage coverage/lcov.info || true

View file

@ -682,6 +682,9 @@ void main() {
expect(client2.rooms[1].id, client1.rooms[1].id);
expect(client2.rooms[1].outboundGroupSession.session_key(), sessionKey);
}
await client1.logout();
await client2.logout();
});
});
}

View file

@ -207,6 +207,8 @@ void main() {
final resp2 = await event.sendAgain(txid: '1234');
expect(resp1, null);
expect(resp2, '42');
await matrix.dispose(closeDatabase: true);
});
test('requestKey', () async {
@ -244,6 +246,8 @@ void main() {
}, Room(id: '!1234:example.com', client: matrix));
await event.requestKey();
await matrix.dispose(closeDatabase: true);
});
});
}

View file

@ -29,7 +29,6 @@ import 'fake_database.dart';
void main() {
/// All Tests related to device keys
group('Room Key Request', () {
test('fromJson', () async {
var rawJson = <String, dynamic>{
'content': {
@ -59,12 +58,13 @@ void main() {
var room = matrix.getRoomById('!726s6s6q:example.com');
if (matrix.encryptionEnabled) {
await room.createOutboundGroupSession();
rawJson['content']['body']['session_id'] = room.inboundGroupSessions.keys.first;
rawJson['content']['body']['session_id'] =
room.inboundGroupSessions.keys.first;
var roomKeyRequest = RoomKeyRequest.fromToDeviceEvent(
ToDeviceEvent.fromJson(rawJson), matrix);
await roomKeyRequest.forwardKey();
}
});
await matrix.dispose(closeDatabase: true);
});
}

View file

@ -26,7 +26,8 @@ import 'package:famedlysdk/src/event.dart';
import 'package:famedlysdk/src/room.dart';
import 'package:famedlysdk/src/user.dart';
import 'package:famedlysdk/src/utils/matrix_file.dart';
import 'package:famedlysdk/src/database/database.dart' show DbRoom, DbRoomState, DbRoomAccountData;
import 'package:famedlysdk/src/database/database.dart'
show DbRoom, DbRoomState, DbRoomAccountData;
import 'package:test/test.dart';
import 'fake_matrix_api.dart';
@ -397,15 +398,16 @@ void main() {
expect(room.outboundGroupSession != null, true);
expect(room.outboundGroupSession.session_id().isNotEmpty, true);
expect(
room.inboundGroupSessions.containsKey(room.outboundGroupSession.session_id()),
room.inboundGroupSessions
.containsKey(room.outboundGroupSession.session_id()),
true);
expect(
room.inboundGroupSessions[room.outboundGroupSession.session_id()]
.content['session_key'],
room.outboundGroupSession.session_key());
expect(
room.inboundGroupSessions[room.outboundGroupSession.session_id()].indexes
.length,
room.inboundGroupSessions[room.outboundGroupSession.session_id()]
.indexes.length,
0);
});
@ -442,5 +444,9 @@ void main() {
expect(decryptedEvent.typeKey, 'm.room.message');
expect(decryptedEvent.content, payload);
});
test('logout', () async {
await matrix.logout();
});
});
}