initial
This commit is contained in:
39
test/test.ts
Normal file
39
test/test.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||||
import { tapNodeTools } from '@push.rocks/tapbundle/node';
|
||||
import * as smartimap from '../ts/index.js';
|
||||
|
||||
let testSmartImap: smartimap.SmartImap;
|
||||
|
||||
tap.test('smartimap', async () => {
|
||||
testSmartImap = new smartimap.SmartImap({
|
||||
host: await tapNodeTools.getEnvVarOnDemand('IMAP_URL'),
|
||||
port: 993,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: await tapNodeTools.getEnvVarOnDemand('IMAP_USER'),
|
||||
pass: await tapNodeTools.getEnvVarOnDemand('IMAP_PASSWORD'),
|
||||
},
|
||||
mailbox: 'INBOX',
|
||||
filter: { seen: true, to: await tapNodeTools.getEnvVarOnDemand('IMAP_USER') },
|
||||
});
|
||||
|
||||
await testSmartImap.connect();
|
||||
|
||||
testSmartImap.on('message', (message) => {
|
||||
console.log(message);
|
||||
});
|
||||
|
||||
testSmartImap.on('error', (error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
testSmartImap.on('connected', () => {
|
||||
console.log('Connected');
|
||||
});
|
||||
|
||||
testSmartImap.on('disconnected', () => {
|
||||
console.log('Disconnected');
|
||||
});
|
||||
});
|
||||
|
||||
tap.start();
|
Reference in New Issue
Block a user