chore: tear down clients in event tests properly
Fixes some noise around logs when I was trying to enable branch coverage.
This commit is contained in:
parent
e1f0d9c0ad
commit
43bc0e1963
|
|
@ -56,6 +56,8 @@ void main() {
|
||||||
final event = Event.fromJson(
|
final event = Event.fromJson(
|
||||||
jsonObj, Room(id: '!testroom:example.abc', client: client));
|
jsonObj, Room(id: '!testroom:example.abc', client: client));
|
||||||
|
|
||||||
|
tearDownAll(() async => client.dispose());
|
||||||
|
|
||||||
test('Create from json', () async {
|
test('Create from json', () async {
|
||||||
jsonObj['content'] = json.decode(contentJson);
|
jsonObj['content'] = json.decode(contentJson);
|
||||||
expect(event.toJson(), jsonObj);
|
expect(event.toJson(), jsonObj);
|
||||||
|
|
@ -237,6 +239,8 @@ void main() {
|
||||||
expect(event.content.isEmpty, true);
|
expect(event.content.isEmpty, true);
|
||||||
redactionEventJson.remove('redacts');
|
redactionEventJson.remove('redacts');
|
||||||
expect(event.unsigned?['redacted_because'], redactionEventJson);
|
expect(event.unsigned?['redacted_because'], redactionEventJson);
|
||||||
|
|
||||||
|
await client.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -248,6 +252,8 @@ void main() {
|
||||||
expect(() async => await event.cancelSend(), throwsException);
|
expect(() async => await event.cancelSend(), throwsException);
|
||||||
event.status = EventStatus.sending;
|
event.status = EventStatus.sending;
|
||||||
await event.cancelSend();
|
await event.cancelSend();
|
||||||
|
|
||||||
|
await room.client.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('sendAgain', () async {
|
test('sendAgain', () async {
|
||||||
|
|
@ -327,6 +333,8 @@ void main() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
expect(event.canRedact, true);
|
expect(event.canRedact, true);
|
||||||
|
|
||||||
|
await client.dispose();
|
||||||
});
|
});
|
||||||
test('getLocalizedBody, isEventKnown', () async {
|
test('getLocalizedBody, isEventKnown', () async {
|
||||||
final matrix = Client('testclient', httpClient: FakeMatrixApi());
|
final matrix = Client('testclient', httpClient: FakeMatrixApi());
|
||||||
|
|
@ -961,6 +969,8 @@ void main() {
|
||||||
expect(await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
expect(await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||||
'Unknown event unknown.event.type');
|
'Unknown event unknown.event.type');
|
||||||
expect(event.isEventTypeKnown, false);
|
expect(event.isEventTypeKnown, false);
|
||||||
|
|
||||||
|
await matrix.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getLocalizedBody, parameters', () async {
|
test('getLocalizedBody, parameters', () async {
|
||||||
|
|
@ -1126,6 +1136,8 @@ void main() {
|
||||||
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||||
'Example accepted key verification request',
|
'Example accepted key verification request',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await matrix.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('aggregations', () {
|
test('aggregations', () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue