1 | const test = require('ava')
|
2 | const path = require('path')
|
3 | const { getFunctions } = require('./get-functions.js')
|
4 | const { findModuleDir } = require('./finders')
|
5 |
|
6 | test('pass empty string', t => {
|
7 | const f = getFunctions('')
|
8 | t.deepEqual(f, {})
|
9 | })
|
10 |
|
11 | test('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 |
|
17 | test('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 | })
|