mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
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:
@@ -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,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
|
||||
|
||||
@@ -24,9 +24,3 @@ export class ThrowsOnParseTag extends Tag {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
export class IntendedRenderErrorTag extends Tag {
|
||||
render () {
|
||||
throw new Error('intended render error')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user