Fix PouchType tests

This commit is contained in:
Timothy Farrell 2018-07-27 16:25:09 -05:00
parent c286ccbc9d
commit 1979836c38
5 changed files with 62 additions and 13 deletions

View File

@ -9,8 +9,9 @@
"src" "src"
], ],
"scripts": { "scripts": {
"test": "node ../../bin/runTests.js ./", "test": "npm run build:test && mv dist/index.html ./.spec_runner.html && node ../../bin/runTests.js ./",
"pre-commit": "npm run test" "pre-commit": "npm run test",
"build:test": "webpack --config webpack.test-config.js"
}, },
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)", "author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -18,6 +19,12 @@
"frptools": "~3.2.1" "frptools": "~3.2.1"
}, },
"devDependencies": { "devDependencies": {
"pouchdb": "~7.0.0" "html-webpack-plugin": "~3.2.0",
"pouchdb": "~7.0.0",
"pouchdb-find": "~7.0.0",
"pouchdb-adapter-memory": "^7.0.0",
"script-ext-html-webpack-plugin": "^2.0.1",
"webpack": "~4.10.2",
"webpack-cli": "~2.1.5"
} }
} }

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v3.1.0</title>
<link rel="shortcut icon" type="image/png" href="/vendor/jasmine/jasmine_favicon.png">
<link rel="stylesheet" href="/vendor/jasmine/jasmine.css">
<script src="/vendor/jasmine/jasmine.js"></script>
<script src="/vendor/jasmine/jasmine-html.js"></script>
<script defer src="/vendor/jasmine/boot.js"></script>
</head><body></body>
</html>

View File

@ -1,6 +1,9 @@
import { TypeHandler } from '../src/index.js'; import { TypeHandler } from '../src/index.js';
import PouchDB from 'pouchdb';
import PouchDBFind from 'pouchdb-find';
import memory from 'pouchdb-adapter-memory';
const PDB = PouchDB.plugin(find); const PDB = PouchDB.plugin(PouchDBFind).plugin(memory);
class ContactHandler extends TypeHandler { class ContactHandler extends TypeHandler {
getUniqueID(doc) { getUniqueID(doc) {

View File

@ -1,9 +0,0 @@
{
"spec_dir": "spec",
"spec_files": ["**/*[sS]pec.js"],
"lib_files": [
"node_modules/pouchdb/dist/pouchdb.js",
"node_modules/pouchdb/dist/pouchdb.memory.js",
"node_modules/pouchdb/dist/pouchdb.find.js"
]
}

View File

@ -0,0 +1,33 @@
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, './spec'),
mode: 'development',
entry: {
livearray: './livearray.spec.js',
typehandler: './typehandler.spec.js',
watcher: './watcher.spec.js'
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].bundle.js',
publicPath: '/packages/pouchtype/dist/'
},
devServer: {
contentBase: path.join(__dirname, 'dist')
},
module: {},
plugins: [
new webpack.DefinePlugin({ __DEV__: true }),
new HtmlWebpackPlugin({
template: 'index.html',
inject: 'body'
}),
new ScriptExtHtmlWebpackPlugin({
module: /.*/
})
]
};