f5976a2d74
* feat: moved tl-runtime to esm and native ArrayBuffers * feat: migration to esm * fix(core): web-related fixes * test: finally, some good fucking e2e * chore: fixed linters etc * ci: added e2e to ci * build(tl): fixed gen-code on node 20 * fix: codegen Uint8Array, not Buffer never `git reset --hard` kids * build: only do type-aware linting for `packages/*` * build: ignore no-unresolved in ci for e2e * fix: node 16 doesn't have subtle crypto apparently? * fix(tests): use Uint8Array for gods sake please can i just merge this already * ci: don't parallel tasks in ci because machines are utter garbage and it may just randomly break * ci: pass secrets to e2e tests * ci: separate cli command for ci apparently im retarded * fix: run codegen in e2e im actually retarded * ci: more fixes for e2e * ci: debugging stuff * ci: still debugging * ci: hopefully fix ci???
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
// import { expect } from 'chai'
|
|
// import { randomBytes } from 'crypto'
|
|
// import { describe, it } from 'mocha'
|
|
//
|
|
// import { sleep } from '../../src.js'
|
|
// import { createTestTelegramClient } from './utils.js'
|
|
//
|
|
// // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
// require('dotenv-flow').config()
|
|
//
|
|
// describe('fuzz : session', async function () {
|
|
// this.timeout(45000)
|
|
//
|
|
// it('random auth_key', async () => {
|
|
// const client = createTestTelegramClient()
|
|
//
|
|
// // random key
|
|
// const initKey = randomBytes(256)
|
|
// await client.storage.setAuthKeyFor(2, initKey)
|
|
//
|
|
// // client is supposed to handle this and generate a new key
|
|
//
|
|
// const errors: Error[] = []
|
|
//
|
|
// const errorHandler = (err: Error) => {
|
|
// errors.push(err)
|
|
// }
|
|
//
|
|
// client.onError(errorHandler)
|
|
//
|
|
// await client.connect()
|
|
//
|
|
// await sleep(10000)
|
|
//
|
|
// await client.close()
|
|
//
|
|
// expect(errors.length).eq(0)
|
|
//
|
|
// expect((await client.storage.getAuthKeyFor(2))?.toString('hex')).not.eq(
|
|
// initKey.toString('hex'),
|
|
// )
|
|
// })
|
|
//
|
|
// it('random auth_key for other dc', async () => {
|
|
// const client = createTestTelegramClient()
|
|
//
|
|
// // random key for dc1
|
|
// const initKey = randomBytes(256)
|
|
// await client.storage.setAuthKeyFor(1, initKey)
|
|
//
|
|
// // client is supposed to handle this and generate a new key
|
|
//
|
|
// const errors: Error[] = []
|
|
//
|
|
// const errorHandler = (err: Error) => {
|
|
// errors.push(err)
|
|
// }
|
|
//
|
|
// client.onError(errorHandler)
|
|
//
|
|
// await client.connect()
|
|
// await client.waitUntilUsable()
|
|
//
|
|
// const conn = await client.createAdditionalConnection(1)
|
|
// await conn.sendRpc({ _: 'help.getConfig' })
|
|
//
|
|
// await sleep(10000)
|
|
//
|
|
// await client.close()
|
|
//
|
|
// expect(errors.length).eq(0)
|
|
//
|
|
// expect((await client.storage.getAuthKeyFor(1))?.toString('hex')).not.eq(
|
|
// initKey.toString('hex'),
|
|
// )
|
|
// })
|
|
// })
|