Skip to content

Commit

Permalink
chore: Remove type checks from unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mvsde committed Mar 27, 2019
1 parent 0f53667 commit 105445f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 96 deletions.
36 changes: 0 additions & 36 deletions test/unit/lib/nunjucks/generate-preview-template.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,3 @@ test('generates custom template', t => {

t.snapshot(template)
})

test('throws Error on missing options', t => {
const error = t.throws(() => {
generatePreviewTemplate({ body: 'test' })
}, Error)

t.is(error.message, 'options.head missing')
})

test('throws TypeError on wrong option types', t => {
const errorTemplate = t.throws(() => {
generatePreviewTemplate({
template: 42,
head: 'test',
body: 'test'
})
}, TypeError)

const errorHead = t.throws(() => {
generatePreviewTemplate({
head: 1337,
body: 'test'
})
}, TypeError)

const errorBody = t.throws(() => {
generatePreviewTemplate({
head: 'test',
body: 3.142
})
}, TypeError)

t.is(errorTemplate.message, 'options.template must be of type string')
t.is(errorHead.message, 'options.head must be of type string')
t.is(errorBody.message, 'options.body must be of type string')
})
20 changes: 0 additions & 20 deletions test/unit/lib/utils/format-name.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,3 @@ test('formats name with double dashes', t => {

t.is(actual, expected)
})

test('throws on empty ‘name’ parameter', t => {
const actual = t.throws(() => { formatName() }).message
const expected = 'Paramater ‘name’ is necessary.'

t.is(actual, expected)
})

test('throws on non-string ‘path’ parameter', t => {
const actualArray = t.throws(() => { formatName([]) }).message
const actualFunction = t.throws(() => { formatName(() => {}) }).message
const actualNumber = t.throws(() => { formatName(2) }).message
const actualObject = t.throws(() => { formatName({}) }).message
const expected = 'Parameter ‘name’ must be a string.'

t.is(actualArray, expected)
t.is(actualFunction, expected)
t.is(actualNumber, expected)
t.is(actualObject, expected)
})
20 changes: 0 additions & 20 deletions test/unit/lib/utils/normalize-path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,3 @@ test('leaves Unix paths as is', t => {

t.is(actual, expected)
})

test('throws on empty ‘path’ parameter', t => {
const actual = t.throws(() => { normalizePath() }).message
const expected = 'Paramater ‘path’ is necessary.'

t.is(actual, expected)
})

test('throws on non-string ‘path’ parameter', t => {
const actualArray = t.throws(() => { normalizePath([]) }).message
const actualFunction = t.throws(() => { normalizePath(() => {}) }).message
const actualNumber = t.throws(() => { normalizePath(2) }).message
const actualObject = t.throws(() => { normalizePath({}) }).message
const expected = 'Parameter ‘path’ must be a string.'

t.is(actualArray, expected)
t.is(actualFunction, expected)
t.is(actualNumber, expected)
t.is(actualObject, expected)
})
20 changes: 0 additions & 20 deletions test/unit/lib/utils/read-file-sync.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,3 @@ test('returns undefined for missing files', t => {

t.is(actual, expected)
})

test('throws on empty ‘filePath’ parameter', t => {
const actual = t.throws(() => { readFileSync() }).message
const expected = 'Paramater ‘filePath’ is necessary.'

t.is(actual, expected)
})

test('throws on non-string ‘filePath’ parameter', t => {
const actualArray = t.throws(() => { readFileSync([]) }).message
const actualFunction = t.throws(() => { readFileSync(() => {}) }).message
const actualNumber = t.throws(() => { readFileSync(2) }).message
const actualObject = t.throws(() => { readFileSync({}) }).message
const expected = 'Parameter ‘filePath’ must be a string.'

t.is(actualArray, expected)
t.is(actualFunction, expected)
t.is(actualNumber, expected)
t.is(actualObject, expected)
})

0 comments on commit 105445f

Please sign in to comment.