@sanity/block-content-tests
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "@sanity/block-content-tests", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Tests for shared block content rendering logic", | ||
@@ -5,0 +5,0 @@ "main": "tests.js", |
12
tests.js
const identity = inp => inp | ||
const defaults = {normalize: identity} | ||
const requireAll = require('require-all') | ||
const fixtures = requireAll(`${__dirname }/fixtures`) | ||
const fixtures = requireAll(`${__dirname}/fixtures`) | ||
@@ -14,6 +14,8 @@ module.exports = function runTests(opts = {}) { | ||
.forEach(fixture => { | ||
const highlight = () => h('mark') | ||
const serializers = {marks: {highlight}} | ||
const originalInput = JSON.parse(JSON.stringify(fixture.input)) | ||
const passedInput = fixture.input | ||
try { | ||
render({blocks: passedInput}) | ||
render({blocks: passedInput, serializers}) | ||
} catch (error) { | ||
@@ -220,2 +222,8 @@ // ignore | ||
test('can specify custom serializers for defaults marks', () => { | ||
const {input, output} = require('./fixtures/061-missing-mark-serializer') | ||
const result = render({blocks: input}) | ||
expect(result).toEqual(normalize(output)) | ||
}) | ||
test('can specify custom class name for container', () => { | ||
@@ -222,0 +230,0 @@ const input = [ |
77394
34
3308