Skip to content

Commit

Permalink
feat: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
int64ago committed Sep 8, 2019
1 parent eaf107d commit 96b9966
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
9 changes: 7 additions & 2 deletions template/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
},
"author": "<%= author %>",
"scripts": {
"test": "mocha",
"lint": "eslint \"**/*.js\"",
"lint:fix": "eslint \"**/*.js\" --fix"
"lint:fix": "eslint \"**/*.js\" --fix",
"prepublishOnly": "npm run lint && npm run test"
},
"dependencies": {},
"devDependencies": {
"@svrx/eslint-config": "^1.0.0",
"chai": "^4.2.0",
"chai-json-schema": "^1.5.1",
"eslint": "^6.2.0",
"husky": "^3.0.4",
"lint-staged": "^9.2.3"
"lint-staged": "^9.2.3",
"mocha": "^6.2.0"
},
"husky": {
"hooks": {
Expand Down
40 changes: 40 additions & 0 deletions template/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const chai = require('chai');

const {
assets = {},
} = require('../index');

chai.use(require('chai-json-schema'));

const { assert } = chai;

const assetsSchema = {
title: 'assets schema',
type: 'object',
properties: {
test: {
type: 'boolean',
},
script: {
type: 'array',
uniqueItems: true,
items: {
type: 'string',
},
},
style: {
type: 'array',
uniqueItems: true,
items: {
type: 'string',
},
},
},
};

describe('Format', () => {
it('assets schema', () => {
assert.jsonSchema(assets, assetsSchema);
});
// TODO: add more tests
});

0 comments on commit 96b9966

Please sign in to comment.