Skip to content

Commit ccba89b

Browse files
committed
Add tests for maybeRawHTMLType
1 parent 1aba8e5 commit ccba89b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/tests/helpers.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { tmpdir } = require('os')
22
const { rm, mkdtemp, mkdir } = require('fs/promises')
33
const { resolve, join } = require('path')
44
const test = require('tape')
5-
const { contentRoot, makePermalink } = require('../helpers')
5+
const { contentRoot, makePermalink, maybeRawHTMLType } = require('../helpers')
66

77
const tempDir = () => {
88
return mkdtemp(join(tmpdir(), 'writ-test-'))
@@ -123,4 +123,16 @@ test('helpers', t => {
123123
t.equal(actual, expected, message)
124124
})
125125
})
126+
127+
t.test('maybeRawHTMLType', async () => {
128+
t.equal(maybeRawHTMLType('.html'), 'raw-html-type', '.html')
129+
t.equal(maybeRawHTMLType('.HTML'), 'raw-html-type', '.HTML')
130+
t.equal(maybeRawHTMLType('.hbs'), 'raw-html-type', '.hbs')
131+
t.equal(maybeRawHTMLType('.handlebars'), 'raw-html-type', '.handlebars')
132+
t.equal(maybeRawHTMLType('.HANDLEBARS'), 'raw-html-type', '.HANDLEBARS')
133+
t.equal(maybeRawHTMLType('.HBS'), 'raw-html-type', '.HBS')
134+
t.equal(maybeRawHTMLType('.xhtml'), null, '.xhtml does not count as raw html type')
135+
t.equal(maybeRawHTMLType('.htm'), null, '.htm does not count as raw html type')
136+
t.equal(maybeRawHTMLType('.xml'), null, '.xml does not count as raw html type')
137+
})
126138
})

0 commit comments

Comments
 (0)