mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-01-26 03:03:59 +00:00
feat(config-checker): new package: config-checker
This commit is contained in:
23
packages/config-checker/__tests__/config-checker.test.js
Normal file
23
packages/config-checker/__tests__/config-checker.test.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const configChecker = require('..')
|
||||
const assert = require('assert').strict
|
||||
|
||||
const configs = configChecker('test', path.join(__dirname, 'fixtures'))
|
||||
|
||||
/**
|
||||
* Checks if an array contains a file.
|
||||
*
|
||||
* @param {string[]} configs - The array of configs to check.
|
||||
* @param {string} file - The file to check for.
|
||||
* @returns {boolean} - True if the array contains the file.
|
||||
*/
|
||||
function arrayContains(configs = [], file = '') {
|
||||
return configs.some(config => config === file)
|
||||
}
|
||||
|
||||
assert.ok(arrayContains(configs, '.testrc'))
|
||||
assert.ok(arrayContains(configs, '.config/testrc.ts'))
|
||||
|
||||
console.info('configChecker tests passed')
|
||||
Reference in New Issue
Block a user