From b4c6acda7ce20978ae618d0e51bc94f07190df29 Mon Sep 17 00:00:00 2001 From: Yang Jun Date: Wed, 8 Jul 2026 00:23:42 +0800 Subject: [PATCH] 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 --- test/integration/liquid/liquid.spec.ts | 6 +++--- test/integration/tags/for.spec.ts | 2 -- test/stub/tags.ts | 6 ------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/test/integration/liquid/liquid.spec.ts b/test/integration/liquid/liquid.spec.ts index af74c5041..360d1b923 100644 --- a/test/integration/liquid/liquid.spec.ts +++ b/test/integration/liquid/liquid.spec.ts @@ -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', () => { diff --git a/test/integration/tags/for.spec.ts b/test/integration/tags/for.spec.ts index daaf2b0bc..1c8c3d7ef 100644 --- a/test/integration/tags/for.spec.ts +++ b/test/integration/tags/for.spec.ts @@ -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 diff --git a/test/stub/tags.ts b/test/stub/tags.ts index 90995238e..6484885c0 100644 --- a/test/stub/tags.ts +++ b/test/stub/tags.ts @@ -24,9 +24,3 @@ export class ThrowsOnParseTag extends Tag { return '' } } - -export class IntendedRenderErrorTag extends Tag { - render () { - throw new Error('intended render error') - } -}