Skip to content

Commit d29b77a

Browse files
committed
Fixed linting issue
1 parent 5a784b7 commit d29b77a

File tree

5 files changed

+75
-49
lines changed

5 files changed

+75
-49
lines changed

test/src/algorithm/ssh_cipher_type_test.dart

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import 'dart:typed_data';
2+
13
import 'package:dartssh2/dartssh2.dart';
24
import 'package:dartssh2/src/ssh_algorithm.dart';
35
import 'package:dartssh2/src/utils/cipher_ext.dart';
46
import 'package:test/test.dart';
5-
import 'dart:typed_data';
67

78
void main() {
89
testCipher(SSHCipherType.aes128cbc);
@@ -42,41 +43,49 @@ void main() {
4243
test('Default values are set correctly', () {
4344
final algorithms = SSHAlgorithms();
4445

45-
expect(algorithms.kex, equals([
46-
SSHKexType.x25519,
47-
SSHKexType.nistp521,
48-
SSHKexType.nistp384,
49-
SSHKexType.nistp256,
50-
SSHKexType.dhGexSha256,
51-
SSHKexType.dh14Sha256,
52-
SSHKexType.dh14Sha1,
53-
SSHKexType.dhGexSha1,
54-
SSHKexType.dh1Sha1,
55-
]));
46+
expect(
47+
algorithms.kex,
48+
equals([
49+
SSHKexType.x25519,
50+
SSHKexType.nistp521,
51+
SSHKexType.nistp384,
52+
SSHKexType.nistp256,
53+
SSHKexType.dhGexSha256,
54+
SSHKexType.dh14Sha256,
55+
SSHKexType.dh14Sha1,
56+
SSHKexType.dhGexSha1,
57+
SSHKexType.dh1Sha1,
58+
]));
5659

57-
expect(algorithms.hostkey, equals([
58-
SSHHostkeyType.ed25519,
59-
SSHHostkeyType.rsaSha512,
60-
SSHHostkeyType.rsaSha256,
61-
SSHHostkeyType.rsaSha1,
62-
SSHHostkeyType.ecdsa521,
63-
SSHHostkeyType.ecdsa384,
64-
SSHHostkeyType.ecdsa256,
65-
]));
60+
expect(
61+
algorithms.hostkey,
62+
equals([
63+
SSHHostkeyType.ed25519,
64+
SSHHostkeyType.rsaSha512,
65+
SSHHostkeyType.rsaSha256,
66+
SSHHostkeyType.rsaSha1,
67+
SSHHostkeyType.ecdsa521,
68+
SSHHostkeyType.ecdsa384,
69+
SSHHostkeyType.ecdsa256,
70+
]));
6671

67-
expect(algorithms.cipher, equals([
68-
SSHCipherType.aes128ctr,
69-
SSHCipherType.aes128cbc,
70-
SSHCipherType.aes256ctr,
71-
SSHCipherType.aes256cbc,
72-
]));
72+
expect(
73+
algorithms.cipher,
74+
equals([
75+
SSHCipherType.aes128ctr,
76+
SSHCipherType.aes128cbc,
77+
SSHCipherType.aes256ctr,
78+
SSHCipherType.aes256cbc,
79+
]));
7380

74-
expect(algorithms.mac, equals([
75-
SSHMacType.hmacSha1,
76-
SSHMacType.hmacSha256,
77-
SSHMacType.hmacSha512,
78-
SSHMacType.hmacMd5,
79-
]));
81+
expect(
82+
algorithms.mac,
83+
equals([
84+
SSHMacType.hmacSha1,
85+
SSHMacType.hmacSha256,
86+
SSHMacType.hmacSha512,
87+
SSHMacType.hmacMd5,
88+
]));
8089
});
8190
}
8291

test/src/algorithm/ssh_hostkey_type_test.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ void main() {
1414
});
1515

1616
test('toString() returns correct format', () {
17-
expect(SSHHostkeyType.rsaSha1.toString(), equals('SSHHostkeyType(ssh-rsa)'));
18-
expect(SSHHostkeyType.rsaSha256.toString(), equals('SSHHostkeyType(rsa-sha2-256)'));
19-
expect(SSHHostkeyType.rsaSha512.toString(), equals('SSHHostkeyType(rsa-sha2-512)'));
20-
expect(SSHHostkeyType.ecdsa256.toString(), equals('SSHHostkeyType(ecdsa-sha2-nistp256)'));
21-
expect(SSHHostkeyType.ecdsa384.toString(), equals('SSHHostkeyType(ecdsa-sha2-nistp384)'));
22-
expect(SSHHostkeyType.ecdsa521.toString(), equals('SSHHostkeyType(ecdsa-sha2-nistp521)'));
23-
expect(SSHHostkeyType.ed25519.toString(), equals('SSHHostkeyType(ssh-ed25519)'));
17+
expect(
18+
SSHHostkeyType.rsaSha1.toString(), equals('SSHHostkeyType(ssh-rsa)'));
19+
expect(SSHHostkeyType.rsaSha256.toString(),
20+
equals('SSHHostkeyType(rsa-sha2-256)'));
21+
expect(SSHHostkeyType.rsaSha512.toString(),
22+
equals('SSHHostkeyType(rsa-sha2-512)'));
23+
expect(SSHHostkeyType.ecdsa256.toString(),
24+
equals('SSHHostkeyType(ecdsa-sha2-nistp256)'));
25+
expect(SSHHostkeyType.ecdsa384.toString(),
26+
equals('SSHHostkeyType(ecdsa-sha2-nistp384)'));
27+
expect(SSHHostkeyType.ecdsa521.toString(),
28+
equals('SSHHostkeyType(ecdsa-sha2-nistp521)'));
29+
expect(SSHHostkeyType.ed25519.toString(),
30+
equals('SSHHostkeyType(ssh-ed25519)'));
2431
});
2532
});
2633
}

test/src/algorithm/ssh_kex_type_test.dart

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ void main() {
99
expect(SSHKexType.nistp256.name, equals('ecdh-sha2-nistp256'));
1010
expect(SSHKexType.nistp384.name, equals('ecdh-sha2-nistp384'));
1111
expect(SSHKexType.nistp521.name, equals('ecdh-sha2-nistp521'));
12-
expect(SSHKexType.dhGexSha256.name, equals('diffie-hellman-group-exchange-sha256'));
13-
expect(SSHKexType.dhGexSha1.name, equals('diffie-hellman-group-exchange-sha1'));
12+
expect(SSHKexType.dhGexSha256.name,
13+
equals('diffie-hellman-group-exchange-sha256'));
14+
expect(SSHKexType.dhGexSha1.name,
15+
equals('diffie-hellman-group-exchange-sha1'));
1416
expect(SSHKexType.dh14Sha1.name, equals('diffie-hellman-group14-sha1'));
15-
expect(SSHKexType.dh14Sha256.name, equals('diffie-hellman-group14-sha256'));
17+
expect(
18+
SSHKexType.dh14Sha256.name, equals('diffie-hellman-group14-sha256'));
1619
expect(SSHKexType.dh1Sha1.name, equals('diffie-hellman-group1-sha1'));
1720
});
1821

19-
test('Static constants have correct digestFactory and isGroupExchange values', () {
22+
test(
23+
'Static constants have correct digestFactory and isGroupExchange values',
24+
() {
2025
expect(SSHKexType.x25519.digestFactory, equals(digestSha256));
2126
expect(SSHKexType.nistp256.digestFactory, equals(digestSha256));
2227
expect(SSHKexType.nistp384.digestFactory, equals(digestSha384));
@@ -40,7 +45,9 @@ void main() {
4045
expect(digest, isA<SHA256Digest>());
4146
});
4247

43-
test('createDigest() returns correct Digest instance for different algorithms', () {
48+
test(
49+
'createDigest() returns correct Digest instance for different algorithms',
50+
() {
4451
final kexTypeSha1 = SSHKexType.dhGexSha1;
4552
final digestSha1 = kexTypeSha1.createDigest();
4653
expect(digestSha1, isA<SHA1Digest>());

test/src/algorithm/ssh_mac_type_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:typed_data';
2+
23
import 'package:dartssh2/dartssh2.dart';
34
import 'package:pointycastle/export.dart';
45
import 'package:test/test.dart';
@@ -26,13 +27,13 @@ void main() {
2627
test('createMac() throws ArgumentError for incorrect key length', () {
2728
final shortKey = Uint8List(15); // One byte too short for hmacMd5
2829
expect(
29-
() => SSHMacType.hmacMd5.createMac(shortKey),
30+
() => SSHMacType.hmacMd5.createMac(shortKey),
3031
throwsArgumentError,
3132
);
3233

3334
final longKey = Uint8List(17); // One byte too long for hmacMd5
3435
expect(
35-
() => SSHMacType.hmacMd5.createMac(longKey),
36+
() => SSHMacType.hmacMd5.createMac(longKey),
3637
throwsArgumentError,
3738
);
3839
});

test/src/mocks/mock_ssh_http_headers.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ class MockSSHHttpHeaders extends SSHHttpHeaders {
1818
@override
1919
void add(String name, Object value, {bool preserveHeaderCase = false}) {
2020
final headerName = preserveHeaderCase ? name : name.toLowerCase();
21-
final valueStr = value is DateTime ? value.toIso8601String() : value.toString();
21+
final valueStr =
22+
value is DateTime ? value.toIso8601String() : value.toString();
2223
_headers.putIfAbsent(headerName, () => []).add(valueStr);
2324
}
2425

2526
@override
2627
void set(String name, Object value, {bool preserveHeaderCase = false}) {
2728
final headerName = preserveHeaderCase ? name : name.toLowerCase();
28-
final valueStr = value is DateTime ? value.toIso8601String() : value.toString();
29+
final valueStr =
30+
value is DateTime ? value.toIso8601String() : value.toString();
2931
_headers[headerName] = [valueStr];
3032
}
3133

0 commit comments

Comments
 (0)