Commit 794e60a6 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[test] Setting up the test framework

parent 5cdae0f4e86e
{
"files.watcherExclude": {
".hg/**": true,
"**/node_modules/**": true
}
}
\ No newline at end of file
......@@ -75,7 +75,7 @@ It is also possible to manually invoke the configured linter as follow:
```sh
cd extension
../cmd run linter
../cmd npm run linter
```
## How to use
......
......@@ -19,6 +19,7 @@ echo "=========================================="
(cd "$ROOT/libview"; npm install)
(cd "$ROOT/libview"; npm run build)
(cd "$ROOT/libview"; npm run linter)
(cd "$ROOT/libview"; npm run test)
echo ""
echo "=========================================="
......@@ -29,6 +30,7 @@ echo "=========================================="
(cd "$ROOT/views-logilab"; npm install)
(cd "$ROOT/views-logilab"; npm run build)
(cd "$ROOT/views-logilab"; npm run linter)
(cd "$ROOT/views-logilab"; npm run test)
echo ""
echo "=========================================="
......@@ -39,6 +41,7 @@ echo "=========================================="
(cd "$ROOT/extension"; npm install)
(cd "$ROOT/extension"; npm run build)
(cd "$ROOT/extension"; npm run linter)
(cd "$ROOT/extension"; npm run test)
echo ""
echo "=========================================="
......
......@@ -5,7 +5,7 @@
"scripts": {
"build": "webpack",
"clean": "rm -rf build/*",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "mocha --reporter spec --require ts-node/register src/**/*.test.ts",
"linter": "tslint -p . -c tslint.json 'src/**/*.ts*' --fix",
"webpack": "webpack -w",
"webpack:production": "NODE_ENV=production webpack"
......@@ -30,15 +30,20 @@
"react-dom": "^16.2.0"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/chrome": "0.0.69",
"@types/mocha": "^5.2.5",
"@types/node": "10.11.0",
"@types/rdflib": "^0.17.0",
"@types/react": "^16.4.6",
"@types/react-dom": "^16.0.6",
"awesome-typescript-loader": "^5.2.0",
"chai": "^4.2.0",
"copy-webpack-plugin": "^4.5.2",
"mocha": "^5.2.0",
"source-map-loader": "^0.2.3",
"tslint": "^5.11.0",
"ts-node": "^7.0.1",
"typescript": "^2.9.2",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1",
......
......@@ -5,7 +5,7 @@
"scripts": {
"build": "webpack",
"clean": "rm -rf build/*",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "mocha --reporter spec --require ts-node/register src/**/*.test.ts",
"linter": "tslint -p . -c tslint.json 'src/**/*.ts' --fix",
"build:production": "NODE_ENV=production webpack"
},
......@@ -23,11 +23,16 @@
"license": "LGPL-3.0",
"dependencies": {},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.5",
"@types/rdflib": "^0.17.0",
"chai": "^4.2.0",
"copy-webpack-plugin": "^4.5.2",
"mocha": "^5.2.0",
"source-map-loader": "^0.2.3",
"tslint": "^5.11.0",
"ts-loader": "^4.4.2",
"ts-node": "^7.0.1",
"typescript": "^2.9.2",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1"
......
/*******************************************************************************
* Copyright 2003-2018 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
* contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
*
* This file is part of CubicWeb.
*
* CubicWeb is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2.1 of the License, or (at your option)
* any later version.
*
* CubicWeb is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import {
serializableResult,
RenderingResult,
NO_LANGUAGE
} from "./application";
import * as chai from "chai";
const expect = chai.expect;
describe("@logilab/libview/application", () => {
it("should serialize a rendering result without the dom", () => {
let r1: RenderingResult = {
dom: new Object() as HTMLElement,
viewId: "test",
suggestedResources: [],
evaluations: [
{
viewId: "xxx",
priority: 10
}
],
languages: [NO_LANGUAGE]
};
let r2 = serializableResult(r1);
expect(r2.dom).equals(null);
expect(r2.viewId).equals(r1.viewId);
expect(r2.suggestedResources).equals(r1.suggestedResources);
expect(r2.evaluations).equals(r1.evaluations);
expect(r2.languages).equals(r1.languages);
});
});
......@@ -5,7 +5,7 @@
"scripts": {
"build": "webpack",
"clean": "rm -rf build/*",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "mocha --reporter spec --require ts-node/register src/**/*.test.ts",
"linter": "tslint -p . -c tslint.json 'src/**/*.ts' --fix",
"build:production": "NODE_ENV=production webpack",
"serve": "webpack && webpack-dev-server"
......@@ -27,13 +27,18 @@
"vue": "^2.5.16"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.5",
"@types/rdflib": "^0.17.0",
"ajv": "^6.5.2",
"chai": "^4.2.0",
"copy-webpack-plugin": "^4.5.2",
"css-loader": "^1.0.0",
"mocha": "^5.2.0",
"source-map-loader": "^0.2.3",
"tslint": "^5.11.0",
"ts-loader": "^4.4.2",
"ts-node": "^7.0.1",
"typescript": "^2.9.2",
"vue-loader": "^15.2.6",
"vue-template-compiler": "^2.5.16",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment