alina sireneva
af54f6e1c3
now they run as-is, without any bundling. this might seem like a downgrade, but we no longer really need to verify that we publish stuff correctly as we delegate that to `@fuman/build` meow
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { after, before, describe, it } from 'node:test'
|
|
import { expect } from 'chai'
|
|
import { TelegramClient } from 'mtcute'
|
|
|
|
import { getApiParams } from './_utils.js'
|
|
|
|
describe('2. calling methods', () => {
|
|
const tg = new TelegramClient(getApiParams('dc2.session'))
|
|
|
|
before(() => tg.connect())
|
|
after(() => tg.close())
|
|
|
|
it('getUsers(@BotFather)', async () => {
|
|
const [user] = await tg.getUsers('botfather')
|
|
|
|
expect(user?.isBot).to.eq(true)
|
|
expect(user?.displayName).to.equal('BotFather')
|
|
})
|
|
|
|
it('getUsers(@BotFather) - cached', async () => {
|
|
const [user] = await tg.getUsers('botfather')
|
|
|
|
expect(user?.isBot).to.eq(true)
|
|
expect(user?.displayName).to.equal('BotFather')
|
|
})
|
|
|
|
it('getHistory(777000)', async () => {
|
|
await tg.findDialogs(777000) // ensure it's cached
|
|
|
|
const history = await tg.getHistory(777000, { limit: 5 })
|
|
|
|
expect(history[0].chat.chatType).to.equal('private')
|
|
expect(history[0].chat.id).to.equal(777000)
|
|
expect(history[0].chat.firstName).to.equal('Telegram')
|
|
})
|
|
})
|