UNPKG

701 BJavaScriptView Raw
1const test = require('ava')
2const path = require('path')
3const { getFunctions } = require('./get-functions.js')
4const { findModuleDir } = require('./finders')
5
6test('pass empty string', t => {
7 const f = getFunctions('')
8 t.deepEqual(f, {})
9})
10
11test('pass directory with no *.js files', t => {
12 const sitePath = path.join(__dirname, '../tests/dummy-site')
13 const f = getFunctions(sitePath)
14 t.deepEqual(f, {})
15})
16
17test('pass dummy repository with *.js files', t => {
18 const sitePath = path.join(__dirname, '../tests/dummy-repo')
19 const f = getFunctions(sitePath)
20 t.deepEqual(f, {
21 index: {
22 functionPath: sitePath + '/index.js',
23 moduleDir: findModuleDir(sitePath)
24 }
25 })
26})