Adding tests.
This commit is contained in:
parent
f44af2f11a
commit
51a37e3c0a
@ -6,7 +6,8 @@
|
|||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"sourceType": "module"
|
"sourceType": "module",
|
||||||
|
"ecmaVersion": "2017"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent": [
|
"indent": [
|
||||||
|
@ -9,15 +9,21 @@
|
|||||||
},
|
},
|
||||||
"author": "mjswensen",
|
"author": "mjswensen",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"jest": {
|
||||||
|
"rootDir": "lib"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "eslint src && babel --out-dir lib src",
|
"build": "eslint src && babel --out-dir lib src",
|
||||||
"start": "watch 'yarn run build' src",
|
"start": "watch 'yarn run build' src",
|
||||||
|
"test": "yarn run build; jest",
|
||||||
"prepublish": "yarn run build"
|
"prepublish": "yarn run build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.18.0",
|
"babel-cli": "^6.18.0",
|
||||||
"babel-preset-latest": "^6.16.0",
|
"babel-preset-latest": "^6.16.0",
|
||||||
"eslint": "^3.12.2",
|
"eslint": "^3.12.2",
|
||||||
|
"jest": "^18.1.0",
|
||||||
|
"themer-colors-default": "^1.0.1",
|
||||||
"watch": "^1.0.1"
|
"watch": "^1.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
20
src/index.spec.js
Normal file
20
src/index.spec.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { render } from './index';
|
||||||
|
import { colors } from 'themer-colors-default';
|
||||||
|
|
||||||
|
describe('Hyper.app theme generator', () => {
|
||||||
|
|
||||||
|
const promisedFiles = render(colors, {});
|
||||||
|
|
||||||
|
it('should render two files when given a color set with both a light and a dark theme', async () => {
|
||||||
|
const files = await Promise.all(promisedFiles);
|
||||||
|
expect(files.length).toBe(2);
|
||||||
|
expect(files.some(file => /dark/.test(file.name))).toBe(true);
|
||||||
|
expect(files.some(file => /light/.test(file.name))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render files with no missing values', async () => {
|
||||||
|
const files = await Promise.all(promisedFiles);
|
||||||
|
expect(files.every(file => !/undefined/.test(file.contents.toString('utf8')))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user