fix: test fixes
This commit is contained in:
parent
406f9e9da3
commit
85d2c5f305
5 changed files with 17 additions and 15 deletions
|
@ -97,7 +97,7 @@ export class HtmlMessageEntityParser implements IMessageEntityParser {
|
|||
function processPendingText(tagEnd = false) {
|
||||
if (!pendingText.length) return
|
||||
|
||||
if (!stacks.pre.length) {
|
||||
if (!stacks.pre?.length) {
|
||||
pendingText = pendingText.replace(/[^\S\u00A0]+/gs, ' ')
|
||||
|
||||
if (tagEnd) pendingText = pendingText.trimEnd()
|
||||
|
@ -124,7 +124,7 @@ export class HtmlMessageEntityParser implements IMessageEntityParser {
|
|||
processPendingText()
|
||||
|
||||
// ignore tags inside pre (except pre)
|
||||
if (name !== 'pre' && stacks.pre.length) return
|
||||
if (name !== 'pre' && stacks.pre?.length) return
|
||||
|
||||
let entity: tl.TypeMessageEntity
|
||||
|
||||
|
@ -269,14 +269,14 @@ export class HtmlMessageEntityParser implements IMessageEntityParser {
|
|||
name = name.toLowerCase()
|
||||
|
||||
// ignore tags inside pre (except pre)
|
||||
if (name !== 'pre' && stacks.pre.length) return
|
||||
if (name !== 'pre' && stacks.pre?.length) return
|
||||
|
||||
const entity = stacks[name].pop()
|
||||
const entity = stacks[name]?.pop()
|
||||
|
||||
if (!entity) return // unmatched close tag
|
||||
|
||||
// ignore nested pre-s
|
||||
if (name !== 'pre' || !stacks.pre.length) {
|
||||
if (name !== 'pre' || !stacks.pre?.length) {
|
||||
entities.push(entity)
|
||||
}
|
||||
},
|
||||
|
|
|
@ -116,7 +116,7 @@ export function generateCodeForErrors(
|
|||
|
||||
for (const [name, code] of Object.entries(errors.base)) {
|
||||
staticsJs += `RpcError.${name} = ${code};\n`
|
||||
staticsTs += ` static ${name} = ${code};\n`
|
||||
staticsTs += ` static ${name}: ${code};\n`
|
||||
}
|
||||
|
||||
for (const error of Object.values(errors.errors)) {
|
||||
|
|
|
@ -138,7 +138,8 @@ describe('generateWriterCodeForTlEntry', () => {
|
|||
'future_salts':function(w,v){w.uint(2924480661);w.vector(m._bare[155834844],h(v,'salts'),1);m._bare[155834844](w,h(v,'current'));},
|
||||
_bare:{
|
||||
155834844:function(w=this,v){w.bytes(h(v,'salt'));},
|
||||
}}`.replace(/^\s+/gm, ''),
|
||||
},
|
||||
}`.replace(/^\s+/gm, ''),
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
@ -53,14 +53,14 @@ describe('mergeTlEntries', () => {
|
|||
'test flags:# foo:flags.0?true = Test;\n' +
|
||||
'test flags:# bar:flags.0?true = Test;\n' +
|
||||
'test flags:# baz:flags.1?true = Test;',
|
||||
'test#e86481ba flags:# bar:flags.0?true baz:flags.1?true foo:flags.0?true = Test;',
|
||||
'test#e86481ba flags:# foo:flags.0?true bar:flags.0?true baz:flags.1?true = Test;',
|
||||
)
|
||||
test(
|
||||
'test flags:# foo:flags.0?true = Test;\n' +
|
||||
'test flags:# foo:flags.0?true bar:flags.0?true = Test;\n' +
|
||||
'test flags:# baz:flags.1?true = Test;\n' +
|
||||
'test flags:# bar:flags.0?true baz:flags.1?true = Test;',
|
||||
'test#e86481ba flags:# bar:flags.0?true baz:flags.1?true foo:flags.0?true = Test;',
|
||||
'test#e86481ba flags:# foo:flags.0?true bar:flags.0?true baz:flags.1?true = Test;',
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -118,7 +118,7 @@ describe('mergeTlSchemas', () => {
|
|||
['test foo:flags.0?true bar:flags.0?true = Test;'],
|
||||
],
|
||||
0,
|
||||
'test#1c173316 bar:flags.0?true foo:flags.0?true = Test;',
|
||||
'test#1c173316 foo:flags.0?true bar:flags.0?true = Test;',
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -160,7 +160,7 @@ describe('mergeTlSchemas', () => {
|
|||
],
|
||||
0,
|
||||
'// @description test ctor',
|
||||
'test#1c173316 bar:flags.0?true foo:flags.0?true = Test;',
|
||||
'test#1c173316 foo:flags.0?true bar:flags.0?true = Test;',
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ import { tl } from '../'
|
|||
readerMap[0].call(null, null)
|
||||
writerMap['mt_message'].call(null, null, {})
|
||||
|
||||
const error: tl.errors.RpcError = new tl.errors.BadRequestError(
|
||||
'BAD_REQUEST',
|
||||
'Client has issued an invalid request'
|
||||
)
|
||||
const error: tl.RpcError = tl.RpcError.create(400, 'BAD_REQUEST')
|
||||
|
||||
if (error.is('FLOOD_WAIT_%d')) {
|
||||
const a: number = error.seconds
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue