build: updated to 179 layer #56

Merged
teidesu merged 13 commits from layer179 into master 2024-05-06 12:28:14 +03:00
2 changed files with 18 additions and 6 deletions
Showing only changes of commit 80ddf85083 - Show all commits

View file

@ -1,6 +1,6 @@
import { assertEquals } from 'https://deno.land/std@0.223.0/assert/mod.ts' import { assertEquals } from 'https://deno.land/std@0.223.0/assert/mod.ts'
import { MtcuteError } from '@mtcute/core' import { MtcuteError, tl } from '@mtcute/core'
import { BaseTelegramClient, TelegramClient } from '@mtcute/core/client.js' import { BaseTelegramClient, TelegramClient } from '@mtcute/core/client.js'
import { getApiParams } from '../utils.ts' import { getApiParams } from '../utils.ts'
@ -29,7 +29,10 @@ Deno.test('1. authorization', { sanitizeResources: false }, async (t) => {
code: () => '22222', code: () => '22222',
}) })
} catch (e) { } catch (e) {
if (e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) { if (
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
) {
// retry with another number // retry with another number
continue continue
} else { } else {
@ -64,7 +67,10 @@ Deno.test('1. authorization', { sanitizeResources: false }, async (t) => {
code: () => '11111', code: () => '11111',
}) })
} catch (e) { } catch (e) {
if (e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) { if (
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
) {
// retry with another number // retry with another number
continue continue
} else { } else {

View file

@ -1,7 +1,7 @@
import { expect } from 'chai' import { expect } from 'chai'
import { describe, it } from 'mocha' import { describe, it } from 'mocha'
import { MtcuteError } from '@mtcute/core' import { MtcuteError, tl } from '@mtcute/core'
import { BaseTelegramClient, TelegramClient } from '@mtcute/core/client.js' import { BaseTelegramClient, TelegramClient } from '@mtcute/core/client.js'
import { getApiParams } from '../utils.js' import { getApiParams } from '../utils.js'
@ -32,7 +32,10 @@ describe('1. authorization', function () {
code: () => '22222', code: () => '22222',
}) })
} catch (e) { } catch (e) {
if (e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) { if (
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
) {
// retry with another number // retry with another number
continue continue
} else { } else {
@ -67,7 +70,10 @@ describe('1. authorization', function () {
code: () => '11111', code: () => '11111',
}) })
} catch (e) { } catch (e) {
if (e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) { if (
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
) {
// retry with another number // retry with another number
continue continue
} else { } else {