include tests folder in package so that default configuration is consistent

Massimo Melina committed Jan 16, 2022 at 11:14 UTC 35758b930174f0676fe16145b03cd2a57d361830
2 files changed +1 -19
package.json
+1 -1
@@ -17,7 +17,7 @@
17 "build-prune": "cd dist/node_modules/yaml/dist && mv doc do_c && cd ../.. && mkdir lodash2 && cp lodash/lodash.min.js lodash2/lodash.js && cp lodash/package.json lodash2 && rm -rf lodash && mv lodash2 lodash && cd .. && nm-prune --force && cd node_modules/yaml/dist && mv do_c doc",
18 "build-all": "rm -rf dist && npm run build && cd frontend && npm install && npm run build && echo COMPLETED",
19 "test": "mocha -r ts-node/register 'tests/**/*.ts'",
20 - "zip-dist": "zip hfs.zip -r config.yaml accounts.yaml READ* dist/* plugins/*",
20 + "zip-dist": "zip hfs.zip -r config.yaml accounts.yaml READ* dist/* plugins/* tests/*",
21 "make-exe-after-build": "pkg . -C brotli"
22 },
23 "bin": "dist/index.js",
tests/test.js deleted
-18
@@ -1,18 +0,0 @@
1 -"use strict";
2 -const axios = require('axios');
3 -describe('file', () => {
4 - itHttp('md', '/NOTES.md', '##');
5 - itHttp('frontend', '/', '<body>');
6 - itHttp('api.list', '/~/api/file_list', data => Array.isArray(data.list));
7 -});
8 -function itHttp(name, uri, test) {
9 - it(name, () => axios.get(uri).then((res) => {
10 - if (typeof test === 'string') {
11 - if (!res.data.includes(test))
12 - throw 'bad content: ' + res.data;
13 - }
14 - else if (typeof test === 'function')
15 - if (!test(res.data))
16 - throw 'test failed: ' + JSON.stringify(res.data);
17 - }));
18 -}