Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @file utils.js test case
* @author xuexb
*/
require('mock-require').stopAll()
const utils = require('../src/utils')
const expect = require('chai').expect
describe('utils.js', () => {
describe('.toArray', () => {
it('should return self if empty', () => {
expect(utils.toArray()).to.be.undefined
expect(utils.toArray('')).to.equal('')
expect(utils.toArray(null)).to.be.null
})
it('should return array if not the empty string', () => {
expect(utils.toArray(['string'])).to.be.a('array').and.to.deep.equal(['string'])
expect(utils.toArray('string')).to.be.a('array').and.to.deep.equal(['string'])
})
})
"use strict"
require("mock-require").stopAll()
require = require("../../../../index.js")(module)
module.exports = require("./main.mjs")