mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 00:55:13 -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 { Liquid, Context, isFalsy } from '../../../src'
|
||||||
import { mock, restore } from '../../stub/mockfs'
|
import { mock, restore } from '../../stub/mockfs'
|
||||||
import { drainStream } from '../../stub/stream'
|
import { drainStream } from '../../stub/stream'
|
||||||
import { IntendedRenderErrorTag } from '../../stub/tags'
|
import { ThrowingTag } from '../../stub/tags'
|
||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
|
|
||||||
describe('Liquid', function () {
|
describe('Liquid', function () {
|
||||||
@@ -232,7 +232,7 @@ describe('Liquid', function () {
|
|||||||
'/root/error.html': 'A{%throwingTag%}B'
|
'/root/error.html': 'A{%throwingTag%}B'
|
||||||
})
|
})
|
||||||
engine = new Liquid({ root: ['/root/'] })
|
engine = new Liquid({ root: ['/root/'] })
|
||||||
engine.registerTag('throwingTag', IntendedRenderErrorTag)
|
engine.registerTag('throwingTag', ThrowingTag)
|
||||||
})
|
})
|
||||||
afterEach(restore)
|
afterEach(restore)
|
||||||
it('should render a simple value', async () => {
|
it('should render a simple value', async () => {
|
||||||
@@ -241,7 +241,7 @@ describe('Liquid', function () {
|
|||||||
})
|
})
|
||||||
it('should throw RenderError when tag throws', async () => {
|
it('should throw RenderError when tag throws', async () => {
|
||||||
const stream = await engine.renderFileToNodeStream('error.html')
|
const stream = await engine.renderFileToNodeStream('error.html')
|
||||||
expect(drainStream(stream)).rejects.toThrow(/intended render error/)
|
expect(drainStream(stream)).rejects.toThrow(/intended error/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('#analyze', () => {
|
describe('#analyze', () => {
|
||||||
|
|||||||
@@ -2,13 +2,11 @@ import { Liquid } from '../../../src/liquid'
|
|||||||
import { Drop } from '../../../src/drop/drop'
|
import { Drop } from '../../../src/drop/drop'
|
||||||
import { Scope } from '../../../src/context/scope'
|
import { Scope } from '../../../src/context/scope'
|
||||||
import { mock, restore } from '../../stub/mockfs'
|
import { mock, restore } from '../../stub/mockfs'
|
||||||
import { IntendedRenderErrorTag } from '../../stub/tags'
|
|
||||||
|
|
||||||
describe('tags/for', function () {
|
describe('tags/for', function () {
|
||||||
let liquid: Liquid, scope: Scope
|
let liquid: Liquid, scope: Scope
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
liquid = new Liquid()
|
liquid = new Liquid()
|
||||||
liquid.registerTag('throwingTag', IntendedRenderErrorTag)
|
|
||||||
scope = {
|
scope = {
|
||||||
one: 1,
|
one: 1,
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
|||||||
@@ -24,9 +24,3 @@ export class ThrowsOnParseTag extends Tag {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IntendedRenderErrorTag extends Tag {
|
|
||||||
render () {
|
|
||||||
throw new Error('intended render error')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user