apeman-tmpl-bud
Version:
apeman template of bud files.
711 lines (650 loc) • 16.4 kB
JavaScript
/**
* Test case for load.
* Runs with mocha.
*/
const load = require('../lib/load.js')
const co = require('co')
const coz = require('coz')
const assert = require('assert')
describe('load', () => {
let tmpDir = `${__dirname}/../tmp`
before(() => co(function * () {
}))
after(() => co(function * () {
}))
it('Render ci', () => co(function * () {
let bud = load({
type: 'ci',
names: [
'build'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-ci/.js.bud`
console.log(bud)
yield coz.render(bud)
}))
it('Render ci misc', () => co(function * () {
let bud = load({
type: 'ciMisc'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-ci/misc/.js.bud`
yield coz.render(bud)
}))
it('Render scss attributes', () => co(function * () {
let bud = load({
type: 'scssAttributes'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-scss/attributes/.scss.bud`
yield coz.render(bud)
}))
it('Render scss components', () => co(function * () {
let bud = load({
type: 'scssComponents'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-scss/components/.scss.bud`
yield coz.render(bud)
}))
it('Render scss media', () => co(function * () {
let bud = load({
type: 'scssMedia'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-scss/media/.scss.bud`
yield coz.render(bud)
}))
it('Render scss variables', () => co(function * () {
let bud = load({
type: 'scssVariables'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-scss/variables/.scss.bud`
yield coz.render(bud)
}))
it('Render locale', () => co(function * () {
let bud = load({
type: 'locale',
namespace: [
'sections',
'titles'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-locale/.json.bud`
yield coz.render(bud)
}))
it('Render env', () => co(function * () {
let bud = load({
type: 'env'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-env/.json.bud`
coz.render(bud)
}))
it('Render db models', () => co(function * () {
let bud = load({
type: 'models',
name: [
'sign',
'user'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-db/models/.json.bud`
coz.render(bud)
}))
it('Render db seeds', () => co(function * () {
let bud = load({
type: 'seeds',
name: [
'sign',
'user'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-db/seeds/.seed.js.bud`
coz.render(bud)
}))
it('Render db hooks', () => co(function * () {
let bud = load({
type: 'hooks',
name: [
'UserVerify',
'UserRecover'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-db/hooks/.hook.js.bud`
coz.render(bud)
}))
it('Render db addons', () => co(function * () {
let bud = load({
type: 'addons',
name: [
'UserSign'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-db/addons/.addon.js.bud`
coz.render(bud)
}))
it('Render guide', () => co(function * () {
let bud = load({
type: 'guides',
name: [
'requirements',
'setup',
'development',
'dockerlize',
'production'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-doc/guides/.json.bud`
coz.render(bud)
}))
it('Render ui route', () => co(function * () {
let bud = load({
type: 'uiRoute'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-route/ui-route/.route.js.bud`
coz.render(bud)
}))
it('Render ui middleware', () => co(function * () {
let bud = load({
type: 'uiMiddleware'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-middleware/ui-middleware/.middleware.js.bud`
coz.render(bud)
}))
it('Render api middleware', () => co(function * () {
let bud = load({
type: 'apiMiddleware',
name: [
'locale'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-middleware/api-middleware/.middleware.js.bud`
coz.render(bud)
}))
it('Render react middleware', () => co(function * () {
let bud = load({
type: 'reactMiddleware'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-middleware/react-middleware/.middleware.js.bud`
coz.render(bud)
}))
it('Render react service', () => co(function * () {
let bud = load({
type: 'reactService',
name: [
'foo',
'bar'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.force = true
bud.path = `${tmpDir}/testing-service/react-service/.service.js.bud`
coz.render(bud)
}))
it('Render api route', () => co(function * () {
let bud = load({
type: 'apiRoute'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-route/api-route/.route.js.bud`
coz.render(bud)
}))
it('Render admin api route', () => co(function * () {
let bud = load({
type: 'apiRoute'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-route/admin-api-route/.route.js.bud`
coz.render(bud)
}))
it('Render schema', () => co(function * () {
let bud = load({
type: 'schema'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-schema/schema/.schema.js.bud`
coz.render(bud)
}))
it('Render react view', () => co(function * () {
let bud = load({
type: 'reactView',
name: [
'splash/SplashTop',
'other/OtherTop',
'sign/SignSignup',
'sign/SignSignin',
'recover/RecoverSend'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/views/.jsx.bud`
coz.render(bud)
}))
it('Render react browser', () => co(function * () {
let bud = load({
type: 'reactBrowser'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/browsers/.js.bud`
coz.render(bud)
}))
it('Render react mixin', () => co(function * () {
let bud = load({
type: 'reactMixin'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/mixins/.js.bud`
coz.render(bud)
}))
it('Render react mixin group', () => co(function * () {
let bud = load({
type: 'reactMixinGroup',
name: [
'view',
'form'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/mixins/groups/.group.jsx.bud`
coz.render(bud)
}))
it('Render react store', () => co(function * () {
let bud = load({
type: 'reactStore',
name: [
'sign'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/stores/.store.js.bud`
coz.render(bud)
}))
it('Render react page', () => co(function * () {
let bud = load({
type: 'reactPage'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/pages/.json.bud`
coz.render(bud)
}))
it('Render react fragment', () => co(function * () {
let bud = load({
type: 'reactFragment'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/fragments/.js.bud`
coz.render(bud)
}))
it('Render react component', () => co(function * () {
let bud = load({
type: 'reactComponent'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-react/components/.js.bud`
coz.render(bud)
}))
it('Render bin daemon', () => co(function * () {
let bud = load({
type: 'binDaemon',
commands: [
'start',
'stop',
'show'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-bin/bin/.json.bud`
coz.render(bud)
}))
it('Render bin app', () => co(function * () {
let bud = load({
type: 'binApp',
commands: [
'start',
'stop',
'show'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-bin/bin/app/.json.bud`
coz.render(bud)
}))
it('Render terminal', () => co(function * () {
let bud = load({
type: 'terminal'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-debug/.terminal.bud`
coz.render(bud)
}))
it('Render util', () => co(function * () {
let bud = load({
type: 'util',
name: [
'array',
'object'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-generic/.util.js.bud`
coz.render(bud)
}))
it('Render node cache', () => co(function * () {
let bud = load({
type: 'nodeCache'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-node/.package.json.bud`
coz.render(bud)
}))
it('Render mysql', () => co(function * () {
let bud = load({
type: 'bin-mysql'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-mysql/.mysql.bud`
coz.render(bud)
}))
it('Render node', () => co(function * () {
let bud = load({
type: 'bin-node'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-node/.node.bud`
coz.render(bud)
}))
it('Render nginx', () => co(function * () {
let bud = load({
type: 'bin-nginx'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-nginx/.nginx.bud`
coz.render(bud)
}))
it('Render env-bin', () => co(function * () {
let bud = load({
type: 'bin-env'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-env-bin/.sh.bud`
coz.render(bud)
}))
it('Render env-local-bin', () => co(function * () {
let bud = load({
type: 'bin-env-local'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-env-local-bin/.sh.bud`
coz.render(bud)
}))
it('Render settings', () => co(function * () {
let bud = load({
type: 'settings',
name: [
'route',
'asset'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-settings/.setting.json.bud`
coz.render(bud)
}))
it('Render route-test', () => co(function * () {
let bud = load({
type: 'route-test'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-route-test/.test.js.bud`
coz.render(bud)
}))
it('Render component-test', () => co(function * () {
let bud = load({
type: 'component-test',
src: '../../components/**/*.js'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-component-test/.test.js.bud`
coz.render(bud)
}))
it('Render static privacy', () => co(function * () {
let bud = load({
type: 'privacy',
langs: 'en,ja'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-statics/.privacy-policy.html.bud`
coz.render(bud)
}))
it('Render static terms', () => co(function * () {
let bud = load({
type: 'terms',
langs: 'en,ja'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-statics/.terms-of-use.html.bud`
coz.render(bud)
}))
it('Render mail templates', () => co(function * () {
let bud = load({
type: 'mailTemplate',
name: [
'email-verify',
'password-reset',
'resign-done'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-mail/templates/.hbs.bud`
coz.render(bud)
}))
it('Render mail triggers', () => co(function * () {
let bud = load({
type: 'mailTrigger',
name: [
'verify'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-mail/triggers/.trigger.js.bud`
coz.render(bud)
}))
it('Render errors', () => co(function * () {
let bud = load({
type: 'error'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-errors/.html.bud`
coz.render(bud)
}))
it('Render readme', () => co(function * () {
let bud = load({
type: 'readme'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-readme/.README.bud`
coz.render(bud)
}))
it('Render consts', () => co(function * () {
let bud = load({
type: 'consts',
suffix: 'constants',
name: [ 'foo', 'bar' ]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-constants/.constants.js.bud`
coz.render(bud)
}))
it('Render extensions', () => co(function * () {
let bud = load({
type: 'extension',
name: [
'props',
'locale'
],
to: 'http.IncomingMessage instances'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-extensions/.extension.js.bud`
coz.render(bud)
}))
it('Render extension tests', () => co(function * () {
let bud = load({
type: 'extensionTest',
src: '../testing-extensions/**/*.js'
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-extension-tests/.test.js.bud`
coz.render(bud)
}))
it('Render code tests', () => co(function * () {
let bud = load({
type: 'code',
name: [
'userRole'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-codes/.code.json.bud`
coz.render(bud)
}))
it('Render helpers', () => co(function * () {
let bud = load({
type: 'reactHelper',
name: [
'foo'
]
}, '444', true)
assert.ok(bud)
assert.ok(bud.tmpl)
bud.mkdirp = true
bud.path = `${tmpDir}/testing-helper/.helper.jsx.bud`
coz.render(bud)
}))
})
/* global describe, before, after, it */