UNPKG

964 BJavaScriptView Raw
1/**
2 * Test case for indexJsBud.
3 * Runs with mocha.
4 */
5'use strict'
6
7/* global describe, before, after, it */
8
9const indexJsBud = require('../lib/index_js_bud.js')
10const assert = require('assert')
11const path = require('path')
12
13const coz = require('coz')
14const mkdirp = require('mkdirp')
15
16describe('index-js-bud', () => {
17 const basedir = path.resolve(__dirname, '..')
18 const tmpDir = path.resolve(basedir, 'tmp/index_js_bud_test/pkg-foo')
19
20 before(async () => {
21 mkdirp.sync(tmpDir)
22 })
23
24 after(async () => {
25 })
26
27 it('Index js bud', async () => {
28 let bud = indexJsBud({
29 dirname: __dirname
30 })
31 assert.ok(bud)
32 bud.path = tmpDir + '/index.js'
33 await coz.render(bud, {
34 cwd: tmpDir
35 })
36 })
37
38 it('Index mjs bud', async () => {
39 let bud = indexJsBud({
40 dirname: __dirname,
41 mjs: true,
42 })
43 assert.ok(bud)
44 bud.path = tmpDir + '/index.mjs'
45 await coz.render(bud, {
46 cwd: tmpDir
47 })
48 })
49})
50