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) {
|
function processPendingText(tagEnd = false) {
|
||||||
if (!pendingText.length) return
|
if (!pendingText.length) return
|
||||||
|
|
||||||
if (!stacks.pre.length) {
|
if (!stacks.pre?.length) {
|
||||||
pendingText = pendingText.replace(/[^\S\u00A0]+/gs, ' ')
|
pendingText = pendingText.replace(/[^\S\u00A0]+/gs, ' ')
|
||||||
|
|
||||||
if (tagEnd) pendingText = pendingText.trimEnd()
|
if (tagEnd) pendingText = pendingText.trimEnd()
|
||||||
|
@ -124,7 +124,7 @@ export class HtmlMessageEntityParser implements IMessageEntityParser {
|
||||||
processPendingText()
|
processPendingText()
|
||||||
|
|
||||||
// ignore tags inside pre (except pre)
|
// ignore tags inside pre (except pre)
|
||||||
if (name !== 'pre' && stacks.pre.length) return
|
if (name !== 'pre' && stacks.pre?.length) return
|
||||||
|
|
||||||
let entity: tl.TypeMessageEntity
|
let entity: tl.TypeMessageEntity
|
||||||
|
|
||||||
|
@ -269,14 +269,14 @@ export class HtmlMessageEntityParser implements IMessageEntityParser {
|
||||||
name = name.toLowerCase()
|
name = name.toLowerCase()
|
||||||
|
|
||||||
// ignore tags inside pre (except pre)
|
// 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
|
if (!entity) return // unmatched close tag
|
||||||
|
|
||||||
// ignore nested pre-s
|
// ignore nested pre-s
|
||||||
if (name !== 'pre' || !stacks.pre.length) {
|
if (name !== 'pre' || !stacks.pre?.length) {
|
||||||
entities.push(entity)
|
entities.push(entity)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -116,7 +116,7 @@ export function generateCodeForErrors(
|
||||||
|
|
||||||
for (const [name, code] of Object.entries(errors.base)) {
|
for (const [name, code] of Object.entries(errors.base)) {
|
||||||
staticsJs += `RpcError.${name} = ${code};\n`
|
staticsJs += `RpcError.${name} = ${code};\n`
|
||||||
staticsTs += ` static ${name} = ${code};\n`
|
staticsTs += ` static ${name}: ${code};\n`
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const error of Object.values(errors.errors)) {
|
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'));},
|
'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:{
|
_bare:{
|
||||||
155834844:function(w=this,v){w.bytes(h(v,'salt'));},
|
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:# foo:flags.0?true = Test;\n' +
|
||||||
'test flags:# bar:flags.0?true = Test;\n' +
|
'test flags:# bar:flags.0?true = Test;\n' +
|
||||||
'test flags:# baz:flags.1?true = Test;',
|
'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(
|
||||||
'test flags:# foo:flags.0?true = Test;\n' +
|
'test flags:# foo:flags.0?true = Test;\n' +
|
||||||
'test flags:# foo:flags.0?true bar: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:# baz:flags.1?true = Test;\n' +
|
||||||
'test flags:# bar:flags.0?true baz:flags.1?true = Test;',
|
'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;'],
|
['test foo:flags.0?true bar:flags.0?true = Test;'],
|
||||||
],
|
],
|
||||||
0,
|
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,
|
0,
|
||||||
'// @description test ctor',
|
'// @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)
|
readerMap[0].call(null, null)
|
||||||
writerMap['mt_message'].call(null, null, {})
|
writerMap['mt_message'].call(null, null, {})
|
||||||
|
|
||||||
const error: tl.errors.RpcError = new tl.errors.BadRequestError(
|
const error: tl.RpcError = tl.RpcError.create(400, 'BAD_REQUEST')
|
||||||
'BAD_REQUEST',
|
|
||||||
'Client has issued an invalid request'
|
if (error.is('FLOOD_WAIT_%d')) {
|
||||||
)
|
const a: number = error.seconds
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue