Adding tests.

This commit is contained in:
Matt Swensen 2016-12-31 22:50:04 -07:00
parent f44af2f11a
commit 51a37e3c0a
4 changed files with 1154 additions and 22 deletions

@ -6,7 +6,8 @@
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
"sourceType": "module",
"ecmaVersion": "2017"
},
"rules": {
"indent": [

@ -9,15 +9,21 @@
},
"author": "mjswensen",
"license": "MIT",
"jest": {
"rootDir": "lib"
},
"scripts": {
"build": "eslint src && babel --out-dir lib src",
"start": "watch 'yarn run build' src",
"test": "yarn run build; jest",
"prepublish": "yarn run build"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-preset-latest": "^6.16.0",
"eslint": "^3.12.2",
"jest": "^18.1.0",
"themer-colors-default": "^1.0.1",
"watch": "^1.0.1"
},
"dependencies": {

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);
});
});

1147
yarn.lock

File diff suppressed because it is too large Load Diff