UNPKG

734 BJavaScriptView Raw
1const assert = require('assert')
2const { ConfigMissingError } = require('./../../lib/common/errors')
3
4describe('errors', () => {
5 it('should throw a ConfigMissingError and match the message', () => {
6 const ThrowError = () => {
7 throw new ConfigMissingError('config_example.json')
8 }
9
10 assert.throws(ThrowError, ConfigMissingError)
11 assert.throws(ThrowError, /Failed to load config "config_example.json" to extend from.$/)
12 })
13
14 it('should throw a ConfigMissingError and match the default message', () => {
15 const ThrowError = () => {
16 throw new ConfigMissingError()
17 }
18
19 assert.throws(ThrowError, ConfigMissingError)
20 assert.throws(ThrowError, /Failed to load a solhint's config file.$/)
21 })
22})