1
1
mirror of https://github.com/primer/css.git synced 2024-12-16 18:44:07 +03:00
css/modules/generator-primer-module/test/generator.spec.js
2017-09-01 11:58:44 -07:00

32 lines
930 B
JavaScript

const test = require("ava")
const assert = require("yeoman-assert")
const generate = require("./lib/generate")
test("file scaffolding", t => {
const module = "primer-test"
return generate({
prompts: {
module,
},
})
.then(path => {
const pkg = path(module, "package.json")
assert.file(pkg)
assert.jsonFileContent(pkg, {name: module},
"Wrong module name in package.json")
assert.jsonFileContent(pkg, {version: "0.1.0"},
"Wrong or empty version in package.json")
const readme = path(module, "README.md")
assert.file(readme)
assert.fileContent(readme, /# Primer .* Test/)
assert.fileContent(readme, `npmjs.org/package/${module}`)
assert.fileContent(readme, `npm install --save ${module}`)
assert.file(path(module, "lib/test.scss"))
t.pass("All the files exist!")
})
})