Skip to content

Commit

Permalink
Add babel-jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbear89 committed Apr 8, 2018
1 parent f5eb4dc commit 3837c35
Show file tree
Hide file tree
Showing 6 changed files with 2,370 additions and 86 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["env", "flow"]
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"lint": "eslint .",
"prebuild": "rm -rf dist/ && flow",
"build": "[ \"$WATCH\" == 'true' ] && rollup -cw || rollup -c",
"test": "jest",
"watch": "WATCH=true yarn build",
"prepublish": "yarn build"
},
Expand All @@ -30,15 +31,17 @@
"dependencies": {},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-jest": "^22.4.3",
"babel-plugin-external-helpers": "^6.18.0",
"babel-preset-env": "^1.6.1",
"babel-preset-flow": "^6.23.0",
"eslint": "^4.19.1",
"eslint-config-mixmax": "^1.0.0",
"eslint-plugin-flowtype": "^2.46.1",
"flow-bin": "^0.69.0",
"jest": "^22.4.3",
"rollup": "^0.57.1",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-flow": "^1.1.1",
"rollup-plugin-node-resolve": "^2.0.0"
}
}
13 changes: 5 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import babel from 'rollup-plugin-babel';
import nodeResolve from 'rollup-plugin-node-resolve';

const flow = require('rollup-plugin-flow');
const pkg = require('./package.json');

const presets = [[
'env',
{
modules: false
}
]];
const presets = [
['env', { modules: false }],
'flow'
];

export default {
input: 'src/browser/index.js',
plugins: [
flow(),
nodeResolve({
browser: true,
}),
babel({
babelrc: false,
presets,
plugins: [
'external-helpers'
Expand Down
9 changes: 9 additions & 0 deletions spec/browser/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Frecency from '../../src/browser';

describe('frecency', () => {
describe('#save', () => {
it('should work.', () => {
expect(true).toBe(true);
});
});
});
5 changes: 2 additions & 3 deletions src/browser/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type FrecencyOptions = {
resourceType: string,
timestampsLimit: number,
recentSelectionsLimit: number,
idAttribute: number
idAttribute: string
};

export type SaveParams = {
Expand All @@ -58,6 +58,5 @@ export type SaveParams = {

export type SortParams = {
searchQuery: string,
results: Object[],
idAttribute: string
results: Object[]
};
Loading

0 comments on commit 3837c35

Please sign in to comment.