UNPKG

meses-messaging

Version:

Meses messaging SDK in JavaScript

31 lines (27 loc) 1 kB
import MesesMessagingApp from '../src/MesesMessagingApp' import PreviousMessageListQuery from '../src/classes/PreviousMessageListQuery' class TestPreviousMessageListQuery { static testLoad() { const app = new MesesMessagingApp('http://meses-api.airyrooms.dev', 'ceres') const query = new PreviousMessageListQuery(app._service, 'chat-101-102', null) query.load(5) .then(result => console.log('First 5: ', result)) .then(() => query.load(5)) .then(result => console.log('Next 5: ', result)) .then(() => query.load(500)) .then(result => console.log('Scrolling till the end')) .then(() => query.load(5)) .then(result => console.log('Should be an empty array: ', result)) .catch(err => console.log(err)) } static run(command) { switch (command) { case 1: TestPreviousMessageListQuery.testLoad() break default: console.log('Please provide the argument') } } } TestPreviousMessageListQuery.run(1)