fix tests and stuffs

This commit is contained in:
Sorunome 2020-05-21 15:32:06 +02:00
parent af961b99dc
commit ead44e4014
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
4 changed files with 7 additions and 9 deletions

View File

@ -113,9 +113,7 @@ abstract class _SignedKey {
}
bool hasValidSignatureChain({Set<String> visited}) {
if (visited == null) {
visited = Set<String>();
}
visited ??= <String>{};
final setKey = '${userId};${identifier}';
if (visited.contains(setKey)) {
return false; // prevent recursion

View File

@ -601,7 +601,7 @@ void main() {
'dSO80A01XiigH3uBiDVx/EjzaoycHcjq9lfQX0uWsqxl2giMIiSPR8a4d291W1ihKJL/a+myXS367WT6NAIcBA'
}
}
});
}, matrix);
test('startOutgoingOlmSessions', () async {
expect(matrix.olmSessions.length, 0);
if (olmEnabled) {

View File

@ -56,21 +56,21 @@ void main() {
};
var userDeviceKeys = <String, DeviceKeysList>{
'@alice:example.com': DeviceKeysList.fromJson(rawListJson),
'@alice:example.com': DeviceKeysList.fromJson(rawListJson, null),
};
var userDeviceKeyRaw = <String, dynamic>{
'@alice:example.com': rawListJson,
};
expect(json.encode(DeviceKeys.fromJson(rawJson).toJson()),
expect(json.encode(DeviceKeys.fromJson(rawJson, null).toJson()),
json.encode(rawJson));
expect(json.encode(DeviceKeysList.fromJson(rawListJson).toJson()),
expect(json.encode(DeviceKeysList.fromJson(rawListJson, null).toJson()),
json.encode(rawListJson));
var mapFromRaw = <String, DeviceKeysList>{};
for (final rawListEntry in userDeviceKeyRaw.entries) {
mapFromRaw[rawListEntry.key] =
DeviceKeysList.fromJson(rawListEntry.value);
DeviceKeysList.fromJson(rawListEntry.value, null);
}
expect(mapFromRaw.toString(), userDeviceKeys.toString());
});

View File

@ -109,7 +109,7 @@ void test() async {
assert(!testClientB
.userDeviceKeys[testUserA].deviceKeys[testClientA.deviceID].blocked);
await testClientA.userDeviceKeys[testUserB].deviceKeys[testClientB.deviceID]
.setVerified(true, testClientA);
.setVerified(true);
print('++++ Check if own olm device is verified by default ++++');
assert(testClientA.userDeviceKeys.containsKey(testUserA));