test: remove dead throwingTag setup and duplicate throw stub

for.spec kept throwingTag registration after #713 removed its test. Reuse ThrowingTag in liquid.spec instead of IntendedRenderErrorTag.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Yang Jun
2026-07-08 00:23:42 +08:00
co-authored by Cursor
parent d83239723d
commit b4c6acda7c
3 changed files with 3 additions and 11 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import { Liquid, Context, isFalsy } from '../../../src'
import { mock, restore } from '../../stub/mockfs'
import { drainStream } from '../../stub/stream'
import { IntendedRenderErrorTag } from '../../stub/tags'
import { ThrowingTag } from '../../stub/tags'
import { resolve } from 'path'
describe('Liquid', function () {
@@ -232,7 +232,7 @@ describe('Liquid', function () {
'/root/error.html': 'A{%throwingTag%}B'
})
engine = new Liquid({ root: ['/root/'] })
engine.registerTag('throwingTag', IntendedRenderErrorTag)
engine.registerTag('throwingTag', ThrowingTag)
})
afterEach(restore)
it('should render a simple value', async () => {
@@ -241,7 +241,7 @@ describe('Liquid', function () {
})
it('should throw RenderError when tag throws', async () => {
const stream = await engine.renderFileToNodeStream('error.html')
expect(drainStream(stream)).rejects.toThrow(/intended render error/)
expect(drainStream(stream)).rejects.toThrow(/intended error/)
})
})
describe('#analyze', () => {
-2
View File
@@ -2,13 +2,11 @@ import { Liquid } from '../../../src/liquid'
import { Drop } from '../../../src/drop/drop'
import { Scope } from '../../../src/context/scope'
import { mock, restore } from '../../stub/mockfs'
import { IntendedRenderErrorTag } from '../../stub/tags'
describe('tags/for', function () {
let liquid: Liquid, scope: Scope
beforeEach(function () {
liquid = new Liquid()
liquid.registerTag('throwingTag', IntendedRenderErrorTag)
scope = {
one: 1,
// eslint-disable-next-line
-6
View File
@@ -24,9 +24,3 @@ export class ThrowsOnParseTag extends Tag {
return ''
}
}
export class IntendedRenderErrorTag extends Tag {
render () {
throw new Error('intended render error')
}
}