2018-11-23 20:55:16 +08:00
|
|
|
const Page = require('./core/page');
|
2018-11-22 04:58:45 +08:00
|
|
|
const Send = require('./chat/send');
|
|
|
|
const Clear = require('./chat/clear');
|
2018-11-23 00:19:29 +08:00
|
|
|
const Copy = require('./chat/copy');
|
2018-11-23 03:15:52 +08:00
|
|
|
const Save = require('./chat/save');
|
2018-11-22 04:58:45 +08:00
|
|
|
|
2018-11-23 00:19:29 +08:00
|
|
|
describe('Chat', () => {
|
|
|
|
test('Send message', async () => {
|
2018-11-22 04:58:45 +08:00
|
|
|
const test = new Send();
|
2018-11-23 00:19:29 +08:00
|
|
|
let response;
|
2018-11-22 04:58:45 +08:00
|
|
|
try {
|
|
|
|
await test.init(Page.getArgs());
|
2018-11-23 00:19:29 +08:00
|
|
|
response = await test.test();
|
2018-11-22 04:58:45 +08:00
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
2018-11-23 00:19:29 +08:00
|
|
|
} finally {
|
2018-11-22 04:58:45 +08:00
|
|
|
await test.close();
|
|
|
|
}
|
2018-11-23 00:19:29 +08:00
|
|
|
expect(response).toBe(true);
|
2018-11-22 04:58:45 +08:00
|
|
|
});
|
|
|
|
|
2018-11-23 00:19:29 +08:00
|
|
|
test('Clear chat', async () => {
|
2018-11-22 04:58:45 +08:00
|
|
|
const test = new Clear();
|
2018-11-23 00:19:29 +08:00
|
|
|
let response;
|
2018-11-22 04:58:45 +08:00
|
|
|
try {
|
|
|
|
await test.init(Page.getArgs());
|
2018-11-23 00:19:29 +08:00
|
|
|
response = await test.test();
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
} finally {
|
2018-11-22 04:58:45 +08:00
|
|
|
await test.close();
|
2018-11-23 00:19:29 +08:00
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Copy chat', async () => {
|
|
|
|
const test = new Copy();
|
|
|
|
let response;
|
|
|
|
try {
|
|
|
|
await test.init(Page.getArgs());
|
|
|
|
response = await test.test();
|
2018-11-22 04:58:45 +08:00
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
2018-11-23 00:19:29 +08:00
|
|
|
} finally {
|
2018-11-22 04:58:45 +08:00
|
|
|
await test.close();
|
|
|
|
}
|
2018-11-23 00:19:29 +08:00
|
|
|
expect(response).toBe(true);
|
2018-11-22 04:58:45 +08:00
|
|
|
});
|
|
|
|
|
2018-11-23 03:15:52 +08:00
|
|
|
test('Save chat', async () => {
|
|
|
|
const test = new Save();
|
|
|
|
let response;
|
|
|
|
try {
|
|
|
|
await test.init(Page.getArgs());
|
|
|
|
response = await test.test();
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
} finally {
|
|
|
|
await test.close();
|
|
|
|
}
|
|
|
|
expect(response).toBe(true);
|
|
|
|
});
|
2018-11-22 04:58:45 +08:00
|
|
|
});
|