imapflow 1.0.200 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +1 -2
- package/.github/CODE_OF_CONDUCT.md +13 -13
- package/.github/ISSUE_TEMPLATE/bug_report.md +10 -8
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -1
- package/.github/workflows/release.yaml +16 -17
- package/.github/workflows/test.yml +2 -2
- package/.ncurc.js +1 -1
- package/.prettierignore +4 -0
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +91 -0
- package/Gruntfile.js +1 -1
- package/eslint.config.js +43 -0
- package/lib/imap-flow.js +6 -6
- package/lib/jp-decoder.js +1 -1
- package/lib/tools.js +3 -3
- package/package.json +12 -7
- package/release-please-config.json +9 -0
- package/test/commands-test.js +6 -6
- package/test/connection-edge-cases-test.js +150 -130
- package/test/connection-test.js +17 -17
- package/test/fixtures/serialized-mimetorture.js +1 -2
- package/test/integration-test.js +10 -10
- package/test/search-compiler-test.js +34 -22
- package/test/special-use-test.js +1 -1
package/test/connection-test.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
const { ImapFlow } = require('../lib/imap-flow');
|
|
4
4
|
|
|
5
5
|
module.exports['Connection: Basic connection options'] = test => {
|
|
6
|
-
let client = new ImapFlow({
|
|
7
|
-
host: 'imap.example.com',
|
|
6
|
+
let client = new ImapFlow({
|
|
7
|
+
host: 'imap.example.com',
|
|
8
8
|
port: 993,
|
|
9
9
|
auth: { user: 'test', pass: 'test' }
|
|
10
10
|
});
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
test.equal(client.host, 'imap.example.com');
|
|
13
13
|
test.equal(client.port, 993);
|
|
14
14
|
test.done();
|
|
@@ -19,7 +19,7 @@ module.exports['Connection: Default options'] = test => {
|
|
|
19
19
|
host: 'imap.example.com',
|
|
20
20
|
auth: { user: 'test', pass: 'test' }
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
test.equal(client.port, 110);
|
|
24
24
|
test.equal(client.secureConnection, false);
|
|
25
25
|
test.done();
|
|
@@ -31,7 +31,7 @@ module.exports['Connection: Secure connection defaults'] = test => {
|
|
|
31
31
|
port: 993,
|
|
32
32
|
auth: { user: 'test', pass: 'test' }
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
test.equal(client.secureConnection, true);
|
|
36
36
|
test.done();
|
|
37
37
|
};
|
|
@@ -45,7 +45,7 @@ module.exports['Connection: TLS options'] = test => {
|
|
|
45
45
|
minVersion: 'TLSv1.3'
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
test.equal(client.options.tls.rejectUnauthorized, false);
|
|
50
50
|
test.equal(client.options.tls.minVersion, 'TLSv1.3');
|
|
51
51
|
test.done();
|
|
@@ -60,7 +60,7 @@ module.exports['Connection: Authentication options'] = test => {
|
|
|
60
60
|
accessToken: 'token123'
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
test.equal(client.options.auth.user, 'testuser');
|
|
65
65
|
test.equal(client.options.auth.pass, 'testpass');
|
|
66
66
|
test.equal(client.options.auth.accessToken, 'token123');
|
|
@@ -73,7 +73,7 @@ module.exports['Connection: Proxy configuration'] = test => {
|
|
|
73
73
|
auth: { user: 'test', pass: 'test' },
|
|
74
74
|
proxy: 'socks5://proxy.example.com:1080'
|
|
75
75
|
});
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
test.equal(client.options.proxy, 'socks5://proxy.example.com:1080');
|
|
78
78
|
test.done();
|
|
79
79
|
};
|
|
@@ -84,13 +84,13 @@ module.exports['Connection: Client info'] = test => {
|
|
|
84
84
|
version: '1.0.0',
|
|
85
85
|
vendor: 'Test Corp'
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
let client = new ImapFlow({
|
|
89
89
|
host: 'imap.example.com',
|
|
90
90
|
auth: { user: 'test', pass: 'test' },
|
|
91
91
|
clientInfo
|
|
92
92
|
});
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
test.equal(client.clientInfo.name, 'Test Client');
|
|
95
95
|
test.equal(client.clientInfo.version, '1.0.0');
|
|
96
96
|
test.equal(client.clientInfo.vendor, 'Test Corp');
|
|
@@ -103,7 +103,7 @@ module.exports['Connection: Logger configuration'] = test => {
|
|
|
103
103
|
auth: { user: 'test', pass: 'test' },
|
|
104
104
|
logger: false
|
|
105
105
|
});
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
test.equal(client.options.logger, false);
|
|
108
108
|
test.done();
|
|
109
109
|
};
|
|
@@ -113,7 +113,7 @@ module.exports['Connection: Stats tracking'] = test => {
|
|
|
113
113
|
host: 'imap.example.com',
|
|
114
114
|
auth: { user: 'test', pass: 'test' }
|
|
115
115
|
});
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
let stats = client.stats();
|
|
118
118
|
test.ok(Object.prototype.hasOwnProperty.call(stats, 'sent'));
|
|
119
119
|
test.ok(Object.prototype.hasOwnProperty.call(stats, 'received'));
|
|
@@ -127,10 +127,10 @@ module.exports['Connection: Random ID generation'] = test => {
|
|
|
127
127
|
host: 'imap.example.com',
|
|
128
128
|
auth: { user: 'test', pass: 'test' }
|
|
129
129
|
});
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
let id1 = client.getRandomId();
|
|
132
132
|
let id2 = client.getRandomId();
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
test.ok(typeof id1 === 'string' && id1.length > 0);
|
|
135
135
|
test.ok(typeof id2 === 'string' && id2.length > 0);
|
|
136
136
|
test.notEqual(id1, id2, 'IDs should be unique');
|
|
@@ -142,7 +142,7 @@ module.exports['Connection: State management'] = test => {
|
|
|
142
142
|
host: 'imap.example.com',
|
|
143
143
|
auth: { user: 'test', pass: 'test' }
|
|
144
144
|
});
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
test.equal(client.state, client.states.NOT_AUTHENTICATED);
|
|
147
147
|
test.equal(client.authenticated, false);
|
|
148
148
|
test.ok(client.capabilities instanceof Map);
|
|
@@ -154,9 +154,9 @@ module.exports['Connection: Event emitter setup'] = test => {
|
|
|
154
154
|
host: 'imap.example.com',
|
|
155
155
|
auth: { user: 'test', pass: 'test' }
|
|
156
156
|
});
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
test.equal(typeof client.on, 'function');
|
|
159
159
|
test.equal(typeof client.emit, 'function');
|
|
160
160
|
test.equal(typeof client.removeListener, 'function');
|
|
161
161
|
test.done();
|
|
162
|
-
};
|
|
162
|
+
};
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
// IMAP response value for Ryan Finnie's MIME Torture Test v1.0
|
|
5
5
|
// Command used: a fetch 1 (ENVELOPE BODYSTRUCTURE FLAGS BODY[])
|
|
6
|
-
input:
|
|
7
|
-
'* 1 FETCH (FLAGS (\\Seen $eee) ENVELOPE ("23 Oct 2003 23:28:34 -0700" "Ryan Finnie\'s MIME Torture Test v1.0" (("Andris Reinman" NIL "andris" "ekiri.ee")) (("Andris Reinman" NIL "andris" "ekiri.ee")) (("Andris Reinman" NIL "andris" "ekiri.ee")) ((NIL NIL "andmekala" "hot.ee")) NIL NIL NIL "<1066976914.4721.5.camel@localhost>") BODYSTRUCTURE (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 617 16 NIL NIL NIL NIL)("message" "rfc822" NIL NIL "I\'ll be whatever I wanna do. --Fry" "7bit" 582 ("23 Oct 2003 22:25:56 -0700" "plain jane message" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066973156.4264.42.camel@localhost>") ("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 311 9 NIL NIL NIL NIL) 18 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Would you kindly shut your noise-hole? --Bender" "7bit" 1460 ("23 Oct 2003 23:15:11 -0700" "messages inside messages inside..." (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066976111.4263.74.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 193 3 NIL NIL NIL NIL)("message" "rfc822" NIL NIL "At the risk of sounding negative, no. --Leela" "7bit" 697 ("23 Oct 2003 23:09:05 -0700" "the original message" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066975745.4263.70.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 78 3 NIL NIL NIL NIL)("application" "x-gzip" ("NAME" "foo.gz") NIL NIL "base64" 58 NIL ("attachment" ("filename" "foo.gz")) NIL NIL) "mixed" ("boundary" "=-XFYecI7w+0shpolXq8bb") NIL NIL NIL) 25 NIL ("inline" NIL) NIL NIL) "mixed" ("boundary" "=-9Brg7LoMERBrIDtMRose") NIL NIL NIL) 49 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Dirt doesn\'t need luck! --Professor" "7bit" 817 ("23 Oct 2003 22:40:49 -0700" "this message JUST contains an attachment" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066974048.4264.62.camel@localhost>") ("application" "x-gzip" ("NAME" "blah.gz") NIL "Attachment has identical content to above foo.gz" "base64" 396 NIL ("attachment" ("filename" "blah.gz")) NIL NIL) 17 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Hold still, I don\'t have good depth perception! --Leela" "7bit" 1045 ("23 Oct 2003 23:09:16 -0700" "Attachment filename vs. name" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066975756.4263.70.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 377 6 NIL NIL NIL NIL)("application" "x-gzip" ("NAME" "blah2.gz") NIL "filename is blah1.gz, name is blah2.gz" "base64" 58 NIL ("attachment" ("filename" "blah1.gz")) NIL NIL) "mixed" ("boundary" "=-1066975756jd02") NIL NIL NIL) 29 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Hello little man. I WILL DESTROY YOU! --Moro" "7bit" 1149 ("23 Oct 2003 23:09:21 -0700" {24}\r\nNo filename? No problem! (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066975761.4263.70.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 517 10 NIL NIL NIL NIL)("application" "x-gzip" NIL NIL "I\'m getting sick of witty things to say" "base64" 58 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "=-1066975756jd03") NIL NIL NIL) 33 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Friends! Help! A guinea pig tricked me! --Zoidberg" "7bit" 896 ("23 Oct 2003 22:40:45 -0700" "html and text, both inline" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066974044.4264.62.camel@localhost>") (("text" "html" ("CHARSET" "utf-8") NIL NIL "8bit" 327 11 NIL NIL NIL NIL)("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 61 2 NIL NIL NIL NIL) "mixed" ("boundary" "=-ZCKMfHzvHMyK1iBu4kff") NIL NIL NIL) 33 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Smeesh! --Amy" "7bit" 642 ("23 Oct 2003 22:41:29 -0700" "text and text, both inline" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066974089.4265.64.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 62 2 NIL NIL NIL NIL)("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 68 2 NIL NIL NIL NIL) "mixed" ("boundary" "=-pNc4wtlOIxs8RcX7H/AK") NIL NIL NIL) 24 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "That\'s not a cigar. Uh... and it\'s not mine. --Hermes" "7bit" 1515 ("23 Oct 2003 22:39:17 -0700" {17}\r\nHTML and... HTML? (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066973957.4263.59.camel@localhost>") (("text" "html" ("CHARSET" "utf-8") NIL NIL "8bit" 824 22 NIL NIL NIL NIL)("text" "html" ("NAME" "htmlfile.html" "CHARSET" "UTF-8") NIL NIL "8bit" 118 6 NIL ("attachment" ("filename" "htmlfile.html")) NIL NIL) "mixed" ("boundary" "=-zxh/IezwzZITiphpcbJZ") NIL NIL NIL) 49 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL {71}\r\nThe spirit is willing, but the flesh is spongy, and\r\n bruised. --Zapp "7bit" 6643 ("23 Oct 2003 22:23:16 -0700" "smiley!" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066972996.4264.39.camel@localhost>") ((((("text" "plain" ("charset" "us-ascii") NIL NIL "quoted-printable" 1606 42 NIL NIL NIL NIL)("text" "html" ("charset" "utf-8") NIL NIL "quoted-printable" 2128 54 NIL NIL NIL NIL) "alternative" ("boundary" "=-dHujWM/Xizz57x/JOmDF") NIL NIL NIL)("image" "png" ("name" "smiley-3.png") "<1066971953.4232.15.camel@localhost>" NIL "base64" 1122 NIL ("attachment" ("filename" "smiley-3.png")) NIL NIL) "related" ("type" "multipart/alternative" "boundary" "=-GpwozF9CQ7NdF+fd+vMG") NIL NIL NIL)("image" "gif" ("name" "dot.gif") NIL NIL "base64" 96 NIL ("attachment" ("filename" "dot.gif")) NIL NIL) "mixed" ("boundary" "=-CgV5jm9HAY9VbUlAuneA") NIL NIL NIL)("application" "pgp-signature" ("name" "signature.asc") NIL "This is a digitally signed message part" "7bit" 196 NIL NIL NIL NIL) "signed" ("micalg" "pgp-sha1" "protocol" "application/pgp-signature" "boundary" "=-vH3FQO9a8icUn1ROCoAi") NIL NIL NIL) 177 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Kittens give Morbo gas. --Morbo" "7bit" 3088 ("23 Oct 2003 22:32:37 -0700" "the PROPER way to do alternative/related" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066973557.4265.51.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 863 22 NIL NIL NIL NIL)(("text" "html" ("CHARSET" "utf-8") NIL NIL "8bit" 1258 22 NIL NIL NIL NIL)("image" "gif" NIL "<1066973340.4232.46.camel@localhost>" NIL "base64" 116 NIL NIL NIL NIL) "related" ("boundary" "=-bFkxH1S3HVGcxi+o/5jG") NIL NIL NIL) "alternative" ("type" "multipart/alternative" "boundary" "=-tyGlQ9JvB5uvPWzozI+y") NIL NIL NIL) 79 NIL ("inline" NIL) NIL NIL) "mixed" ("boundary" "=-qYxqvD9rbH0PNeExagh1") NIL NIL NIL) BODY[] {0}\r\n)',
|
|
6
|
+
input: '* 1 FETCH (FLAGS (\\Seen $eee) ENVELOPE ("23 Oct 2003 23:28:34 -0700" "Ryan Finnie\'s MIME Torture Test v1.0" (("Andris Reinman" NIL "andris" "ekiri.ee")) (("Andris Reinman" NIL "andris" "ekiri.ee")) (("Andris Reinman" NIL "andris" "ekiri.ee")) ((NIL NIL "andmekala" "hot.ee")) NIL NIL NIL "<1066976914.4721.5.camel@localhost>") BODYSTRUCTURE (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 617 16 NIL NIL NIL NIL)("message" "rfc822" NIL NIL "I\'ll be whatever I wanna do. --Fry" "7bit" 582 ("23 Oct 2003 22:25:56 -0700" "plain jane message" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066973156.4264.42.camel@localhost>") ("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 311 9 NIL NIL NIL NIL) 18 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Would you kindly shut your noise-hole? --Bender" "7bit" 1460 ("23 Oct 2003 23:15:11 -0700" "messages inside messages inside..." (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066976111.4263.74.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 193 3 NIL NIL NIL NIL)("message" "rfc822" NIL NIL "At the risk of sounding negative, no. --Leela" "7bit" 697 ("23 Oct 2003 23:09:05 -0700" "the original message" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066975745.4263.70.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 78 3 NIL NIL NIL NIL)("application" "x-gzip" ("NAME" "foo.gz") NIL NIL "base64" 58 NIL ("attachment" ("filename" "foo.gz")) NIL NIL) "mixed" ("boundary" "=-XFYecI7w+0shpolXq8bb") NIL NIL NIL) 25 NIL ("inline" NIL) NIL NIL) "mixed" ("boundary" "=-9Brg7LoMERBrIDtMRose") NIL NIL NIL) 49 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Dirt doesn\'t need luck! --Professor" "7bit" 817 ("23 Oct 2003 22:40:49 -0700" "this message JUST contains an attachment" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066974048.4264.62.camel@localhost>") ("application" "x-gzip" ("NAME" "blah.gz") NIL "Attachment has identical content to above foo.gz" "base64" 396 NIL ("attachment" ("filename" "blah.gz")) NIL NIL) 17 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Hold still, I don\'t have good depth perception! --Leela" "7bit" 1045 ("23 Oct 2003 23:09:16 -0700" "Attachment filename vs. name" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066975756.4263.70.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 377 6 NIL NIL NIL NIL)("application" "x-gzip" ("NAME" "blah2.gz") NIL "filename is blah1.gz, name is blah2.gz" "base64" 58 NIL ("attachment" ("filename" "blah1.gz")) NIL NIL) "mixed" ("boundary" "=-1066975756jd02") NIL NIL NIL) 29 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Hello little man. I WILL DESTROY YOU! --Moro" "7bit" 1149 ("23 Oct 2003 23:09:21 -0700" {24}\r\nNo filename? No problem! (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066975761.4263.70.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 517 10 NIL NIL NIL NIL)("application" "x-gzip" NIL NIL "I\'m getting sick of witty things to say" "base64" 58 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "=-1066975756jd03") NIL NIL NIL) 33 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Friends! Help! A guinea pig tricked me! --Zoidberg" "7bit" 896 ("23 Oct 2003 22:40:45 -0700" "html and text, both inline" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066974044.4264.62.camel@localhost>") (("text" "html" ("CHARSET" "utf-8") NIL NIL "8bit" 327 11 NIL NIL NIL NIL)("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 61 2 NIL NIL NIL NIL) "mixed" ("boundary" "=-ZCKMfHzvHMyK1iBu4kff") NIL NIL NIL) 33 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Smeesh! --Amy" "7bit" 642 ("23 Oct 2003 22:41:29 -0700" "text and text, both inline" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066974089.4265.64.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 62 2 NIL NIL NIL NIL)("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 68 2 NIL NIL NIL NIL) "mixed" ("boundary" "=-pNc4wtlOIxs8RcX7H/AK") NIL NIL NIL) 24 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "That\'s not a cigar. Uh... and it\'s not mine. --Hermes" "7bit" 1515 ("23 Oct 2003 22:39:17 -0700" {17}\r\nHTML and... HTML? (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066973957.4263.59.camel@localhost>") (("text" "html" ("CHARSET" "utf-8") NIL NIL "8bit" 824 22 NIL NIL NIL NIL)("text" "html" ("NAME" "htmlfile.html" "CHARSET" "UTF-8") NIL NIL "8bit" 118 6 NIL ("attachment" ("filename" "htmlfile.html")) NIL NIL) "mixed" ("boundary" "=-zxh/IezwzZITiphpcbJZ") NIL NIL NIL) 49 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL {71}\r\nThe spirit is willing, but the flesh is spongy, and\r\n bruised. --Zapp "7bit" 6643 ("23 Oct 2003 22:23:16 -0700" "smiley!" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066972996.4264.39.camel@localhost>") ((((("text" "plain" ("charset" "us-ascii") NIL NIL "quoted-printable" 1606 42 NIL NIL NIL NIL)("text" "html" ("charset" "utf-8") NIL NIL "quoted-printable" 2128 54 NIL NIL NIL NIL) "alternative" ("boundary" "=-dHujWM/Xizz57x/JOmDF") NIL NIL NIL)("image" "png" ("name" "smiley-3.png") "<1066971953.4232.15.camel@localhost>" NIL "base64" 1122 NIL ("attachment" ("filename" "smiley-3.png")) NIL NIL) "related" ("type" "multipart/alternative" "boundary" "=-GpwozF9CQ7NdF+fd+vMG") NIL NIL NIL)("image" "gif" ("name" "dot.gif") NIL NIL "base64" 96 NIL ("attachment" ("filename" "dot.gif")) NIL NIL) "mixed" ("boundary" "=-CgV5jm9HAY9VbUlAuneA") NIL NIL NIL)("application" "pgp-signature" ("name" "signature.asc") NIL "This is a digitally signed message part" "7bit" 196 NIL NIL NIL NIL) "signed" ("micalg" "pgp-sha1" "protocol" "application/pgp-signature" "boundary" "=-vH3FQO9a8icUn1ROCoAi") NIL NIL NIL) 177 NIL ("inline" NIL) NIL NIL)("message" "rfc822" NIL NIL "Kittens give Morbo gas. --Morbo" "7bit" 3088 ("23 Oct 2003 22:32:37 -0700" "the PROPER way to do alternative/related" (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) (("Ryan Finnie" NIL "rfinnie" "domain.dom")) ((NIL NIL "bob" "domain.dom")) NIL NIL NIL "<1066973557.4265.51.camel@localhost>") (("text" "plain" ("CHARSET" "US-ASCII") NIL NIL "8bit" 863 22 NIL NIL NIL NIL)(("text" "html" ("CHARSET" "utf-8") NIL NIL "8bit" 1258 22 NIL NIL NIL NIL)("image" "gif" NIL "<1066973340.4232.46.camel@localhost>" NIL "base64" 116 NIL NIL NIL NIL) "related" ("boundary" "=-bFkxH1S3HVGcxi+o/5jG") NIL NIL NIL) "alternative" ("type" "multipart/alternative" "boundary" "=-tyGlQ9JvB5uvPWzozI+y") NIL NIL NIL) 79 NIL ("inline" NIL) NIL NIL) "mixed" ("boundary" "=-qYxqvD9rbH0PNeExagh1") NIL NIL NIL) BODY[] {0}\r\n)',
|
|
8
7
|
output: {
|
|
9
8
|
tag: '*',
|
|
10
9
|
command: '1',
|
package/test/integration-test.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports['Integration: Basic client creation'] = test => {
|
|
|
7
7
|
host: 'imap.example.com',
|
|
8
8
|
auth: { user: 'test', pass: 'test' }
|
|
9
9
|
});
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
test.ok(client);
|
|
12
12
|
test.equal(client.state, client.states.NOT_AUTHENTICATED);
|
|
13
13
|
test.equal(client.authenticated, false);
|
|
@@ -19,12 +19,12 @@ module.exports['Integration: Multiple client instances'] = test => {
|
|
|
19
19
|
host: 'imap1.example.com',
|
|
20
20
|
auth: { user: 'test1', pass: 'test1' }
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
let client2 = new ImapFlow({
|
|
24
24
|
host: 'imap2.example.com',
|
|
25
25
|
auth: { user: 'test2', pass: 'test2' }
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
test.ok(client1);
|
|
29
29
|
test.ok(client2);
|
|
30
30
|
test.notEqual(client1.id, client2.id);
|
|
@@ -39,7 +39,7 @@ module.exports['Integration: Client configuration'] = test => {
|
|
|
39
39
|
auth: { user: 'test', pass: 'test' },
|
|
40
40
|
logger: false
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
test.equal(client.host, 'imap.example.com');
|
|
44
44
|
test.equal(client.port, 993);
|
|
45
45
|
test.equal(client.secureConnection, true);
|
|
@@ -51,14 +51,14 @@ module.exports['Integration: Event emitter functionality'] = test => {
|
|
|
51
51
|
host: 'imap.example.com',
|
|
52
52
|
auth: { user: 'test', pass: 'test' }
|
|
53
53
|
});
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
let eventFired = false;
|
|
56
56
|
client.on('test-event', () => {
|
|
57
57
|
eventFired = true;
|
|
58
58
|
});
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
client.emit('test-event');
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
setTimeout(() => {
|
|
63
63
|
test.ok(eventFired);
|
|
64
64
|
test.done();
|
|
@@ -70,14 +70,14 @@ module.exports['Integration: Stats functionality'] = test => {
|
|
|
70
70
|
host: 'imap.example.com',
|
|
71
71
|
auth: { user: 'test', pass: 'test' }
|
|
72
72
|
});
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
let stats = client.stats();
|
|
75
75
|
test.ok(typeof stats === 'object');
|
|
76
76
|
test.ok(Object.prototype.hasOwnProperty.call(stats, 'sent'));
|
|
77
77
|
test.ok(Object.prototype.hasOwnProperty.call(stats, 'received'));
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
// Reset stats
|
|
80
80
|
let resetStats = client.stats(true);
|
|
81
81
|
test.ok(typeof resetStats === 'object');
|
|
82
82
|
test.done();
|
|
83
|
-
};
|
|
83
|
+
};
|
|
@@ -20,24 +20,28 @@ let createMockMailbox = () => ({
|
|
|
20
20
|
module.exports['Search Compiler: Basic functionality'] = test => {
|
|
21
21
|
let connection = createMockConnection();
|
|
22
22
|
let mailbox = createMockMailbox();
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
test.doesNotThrow(() => {
|
|
25
25
|
let compiled = searchCompiler(connection, { seen: false }, mailbox);
|
|
26
26
|
test.ok(Array.isArray(compiled));
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
test.done();
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
module.exports['Search Compiler: Text searches'] = test => {
|
|
33
33
|
let connection = createMockConnection();
|
|
34
34
|
let mailbox = createMockMailbox();
|
|
35
|
-
|
|
36
|
-
let compiled = searchCompiler(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
|
|
36
|
+
let compiled = searchCompiler(
|
|
37
|
+
connection,
|
|
38
|
+
{
|
|
39
|
+
from: 'user@example.com',
|
|
40
|
+
subject: 'Test'
|
|
41
|
+
},
|
|
42
|
+
mailbox
|
|
43
|
+
);
|
|
44
|
+
|
|
41
45
|
test.ok(Array.isArray(compiled));
|
|
42
46
|
test.ok(compiled.length > 0);
|
|
43
47
|
test.done();
|
|
@@ -46,12 +50,16 @@ module.exports['Search Compiler: Text searches'] = test => {
|
|
|
46
50
|
module.exports['Search Compiler: Flag searches'] = test => {
|
|
47
51
|
let connection = createMockConnection();
|
|
48
52
|
let mailbox = createMockMailbox();
|
|
49
|
-
|
|
50
|
-
let compiled = searchCompiler(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
|
|
54
|
+
let compiled = searchCompiler(
|
|
55
|
+
connection,
|
|
56
|
+
{
|
|
57
|
+
seen: true,
|
|
58
|
+
answered: false
|
|
59
|
+
},
|
|
60
|
+
mailbox
|
|
61
|
+
);
|
|
62
|
+
|
|
55
63
|
test.ok(Array.isArray(compiled));
|
|
56
64
|
test.ok(compiled.length > 0);
|
|
57
65
|
test.done();
|
|
@@ -60,11 +68,15 @@ module.exports['Search Compiler: Flag searches'] = test => {
|
|
|
60
68
|
module.exports['Search Compiler: Date searches'] = test => {
|
|
61
69
|
let connection = createMockConnection();
|
|
62
70
|
let mailbox = createMockMailbox();
|
|
63
|
-
|
|
64
|
-
let compiled = searchCompiler(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
|
|
72
|
+
let compiled = searchCompiler(
|
|
73
|
+
connection,
|
|
74
|
+
{
|
|
75
|
+
since: new Date('2023-01-01')
|
|
76
|
+
},
|
|
77
|
+
mailbox
|
|
78
|
+
);
|
|
79
|
+
|
|
68
80
|
test.ok(Array.isArray(compiled));
|
|
69
81
|
test.ok(compiled.length > 0);
|
|
70
82
|
test.done();
|
|
@@ -73,9 +85,9 @@ module.exports['Search Compiler: Date searches'] = test => {
|
|
|
73
85
|
module.exports['Search Compiler: Empty query'] = test => {
|
|
74
86
|
let connection = createMockConnection();
|
|
75
87
|
let mailbox = createMockMailbox();
|
|
76
|
-
|
|
88
|
+
|
|
77
89
|
let compiled = searchCompiler(connection, {}, mailbox);
|
|
78
|
-
|
|
90
|
+
|
|
79
91
|
test.ok(Array.isArray(compiled));
|
|
80
92
|
test.done();
|
|
81
|
-
};
|
|
93
|
+
};
|
package/test/special-use-test.js
CHANGED