Skip to content

Commit

Permalink
Chore: improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-virkus committed Dec 8, 2023
1 parent 0bbcd51 commit 9fe7d2d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'dart:convert';
import 'package:crypto/crypto.dart';
import 'dart:typed_data';

import 'package:crypto/crypto.dart';

import '../../../smtp/smtp_response.dart';
import '../smtp_command.dart';

Expand Down
39 changes: 16 additions & 23 deletions test/mail/mail_account_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {

group('Serialization', () {
test('Test ServerConfig', () async {
final originalServerConfig = ServerConfig(
const originalServerConfig = ServerConfig(
type: ServerType.imap,
hostname: 'imap.example.com',
port: 993,
Expand All @@ -37,7 +37,7 @@ void main() {
});

test('serialize account', () {
final original = MailAccount(
const original = MailAccount(
email: '[email protected]',
name: 'A name with "quotes"',
outgoingClientDomain: 'outgoing.com',
Expand All @@ -51,9 +51,8 @@ void main() {
authentication: Authentication.plain,
usernameType: UsernameType.emailAddress,
),
authentication:
const PlainAuthentication('[email protected]', 'secret'),
serverCapabilities: [const Capability('IMAP4')],
authentication: PlainAuthentication('[email protected]', 'secret'),
serverCapabilities: [Capability('IMAP4')],
pathSeparator: '/',
),
outgoing: MailServerConfig(
Expand All @@ -65,11 +64,10 @@ void main() {
authentication: Authentication.plain,
usernameType: UsernameType.emailAddress,
),
authentication:
const PlainAuthentication('[email protected]', 'secret'),
authentication: PlainAuthentication('[email protected]', 'secret'),
),
supportsPlusAliases: true,
aliases: [const MailAddress('just tester', '[email protected]')],
aliases: [MailAddress('just tester', '[email protected]')],
);
_compareAfterJsonSerialization(original);
});
Expand All @@ -89,7 +87,7 @@ void main() {
name: 'A name with "quotes"',
outgoingClientDomain: 'outgoing.com',
incoming: MailServerConfig(
serverConfig: ServerConfig(
serverConfig: const ServerConfig(
type: ServerType.imap,
hostname: 'imap.domain.com',
port: 993,
Expand All @@ -106,7 +104,7 @@ void main() {
pathSeparator: '/',
),
outgoing: MailServerConfig(
serverConfig: ServerConfig(
serverConfig: const ServerConfig(
type: ServerType.smtp,
hostname: 'smtp.domain.com',
port: 993,
Expand Down Expand Up @@ -152,7 +150,7 @@ void main() {

test('serialize list of accounts', () {
final accounts = [
MailAccount(
const MailAccount(
email: '[email protected]',
name: 'A name with "quotes"',
userName: 'Andrea Ghez',
Expand All @@ -165,9 +163,8 @@ void main() {
socketType: SocketType.ssl,
authentication: Authentication.plain,
usernameType: UsernameType.emailAddress),
authentication:
const PlainAuthentication('[email protected]', 'secret'),
serverCapabilities: [const Capability('IMAP4')],
authentication: PlainAuthentication('[email protected]', 'secret'),
serverCapabilities: [Capability('IMAP4')],
pathSeparator: '/',
),
outgoing: MailServerConfig(
Expand All @@ -178,11 +175,10 @@ void main() {
socketType: SocketType.ssl,
authentication: Authentication.plain,
usernameType: UsernameType.emailAddress),
authentication:
const PlainAuthentication('[email protected]', 'secret'),
authentication: PlainAuthentication('[email protected]', 'secret'),
),
),
MailAccount(
const MailAccount(
email: '[email protected]',
name: 'my second account',
userName: 'First Last',
Expand All @@ -196,11 +192,8 @@ void main() {
authentication: Authentication.plain,
usernameType: UsernameType.emailAddress),
authentication:
const PlainAuthentication('[email protected]', 'verysecret'),
serverCapabilities: [
const Capability('IMAP4'),
const Capability('IDLE')
],
PlainAuthentication('[email protected]', 'verysecret'),
serverCapabilities: [Capability('IMAP4'), Capability('IDLE')],
pathSeparator: '/',
),
outgoing: MailServerConfig(
Expand All @@ -212,7 +205,7 @@ void main() {
authentication: Authentication.plain,
usernameType: UsernameType.emailAddress),
authentication:
const PlainAuthentication('[email protected]', 'topsecret'),
PlainAuthentication('[email protected]', 'topsecret'),
),
),
];
Expand Down
6 changes: 3 additions & 3 deletions test/src/imap/fetch_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ void main() {
var lastLineEndedInData = false;
for (final text in responseTexts) {
if (lastLineEndedInData) {
final rawData = utf8.encode(text) as Uint8List;
final rawData = utf8.encode(text);
details.add(ImapResponseLine.raw(rawData));
lastLineEndedInData = false;
} else {
Expand Down Expand Up @@ -1085,7 +1085,7 @@ void main() {

final details = ImapResponse()
..add(ImapResponseLine(responseText1))
..add(ImapResponseLine.raw(utf8.encode(responseText2) as Uint8List))
..add(ImapResponseLine.raw(utf8.encode(responseText2)))
..add(ImapResponseLine(responseText3));
final parser = FetchParser(isUidFetch: false);
final response = Response<FetchImapResult>()..status = ResponseStatus.ok;
Expand Down Expand Up @@ -1205,7 +1205,7 @@ void main() {
'''* 65300 FETCH (UID 355372 ENVELOPE ("Sat, 13 Nov 2021 09:01:57 +0100 (CET)" {108}'''))
..add(ImapResponseLine.raw(utf8
.encode('''=?UTF-8?Q?Anzeige_"K=C3=BCchenutensilien,_K=C3=A4seme?=\r
=?UTF-8?Q?sser"_erfolgreich_ver=C3=B6ffentlicht.?=''') as Uint8List))
=?UTF-8?Q?sser"_erfolgreich_ver=C3=B6ffentlicht.?=''')))
..add(ImapResponseLine(
''' (("eBay Kleinanzeigen" NIL "noreply" "ebay-kleinanzeigen.de")) (("eBay Kleinanzeigen" NIL "noreply" "ebay-kleinanzeigen.de")) (("eBay Kleinanzeigen" NIL "noreply" "ebay-kleinanzeigen.de")) ((NIL NIL "some.one" "domain.com")) NIL NIL NIL "<709648757.77104.1636790517873@tns-consumer-app-7.tns-consumer-app.ebayk.svc.cluster.local>"))'''));
final parser = FetchParser(isUidFetch: false);
Expand Down

0 comments on commit 9fe7d2d

Please sign in to comment.