Setup unit testing for document list

- initial structure and npm commands

refs #9
This commit is contained in:
Denys Vuika
2016-05-05 12:53:38 +01:00
parent 95f12f6519
commit 67e9cf7486
6 changed files with 127 additions and 4 deletions

View File

@@ -7,7 +7,9 @@
"build": "typings install && tsc",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
"typings": "typings",
"test": "live-server --open=test/index.html --mount=/ng2-alfresco-core:../ng2-alfresco-core",
"test:w": "concurrently \"npm run tsc:w\" \"npm run test\" "
},
"repository": {
"type": "git",
@@ -38,11 +40,14 @@
"zone.js": "0.6.10"
},
"peerDependencies": {
"angular2": "2.0.0-beta.15",
"ng2-alfresco-core": "0.1.0"
"angular2": "2.0.0-beta.15"
},
"devDependencies": {
"typescript": "^1.8.10",
"typings": "^0.7.12"
"typings": "^0.7.12",
"jasmine-core": "2.4.1",
"xo": "^0.14.0",
"live-server": "^0.9.2",
"concurrently": "^2.0.0"
}
}

View File

@@ -0,0 +1,37 @@
/**
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
System.register(['../../src/components/document-list'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var document_list_1;
return {
setters:[
function (document_list_1_1) {
document_list_1 = document_list_1_1;
}],
execute: function() {
describe('document-list', function () {
it('should setup default columns', function () {
var list = new document_list_1.DocumentList(null);
list.ngAfterContentInit();
expect(list.columns.length).not.toBe(0);
});
});
}
}
});
//# sourceMappingURL=document-list.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"document-list.spec.js","sourceRoot":"","sources":["document-list.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;YAIH,QAAQ,CAAC,eAAe,EAAE;gBAEtB,EAAE,CAAC,8BAA8B,EAAE;oBAC/B,IAAI,IAAI,GAAiB,IAAI,4BAAY,CAAC,IAAI,CAAC,CAAC;oBAChD,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBAC1B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC5C,CAAC,CAAC,CAAC;YAEP,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {DocumentList} from '../../src/components/document-list';
describe('document-list', () => {
it('should setup default columns', () => {
let list: DocumentList = new DocumentList(null);
list.ngAfterContentInit();
expect(list.columns.length).not.toBe(0);
});
});

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Document List Tests</title>
<link rel="stylesheet" href="../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>
</head>
<body>
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
<script src="../node_modules/es6-shim/es6-shim.min.js"></script>
<script src="../node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="../node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="../node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="../node_modules/systemjs/dist/system.src.js"></script>
<script src="../node_modules/rxjs/bundles/Rx.js"></script>
<script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="../node_modules/angular2/bundles/http.dev.js"></script>
<script src="../node_modules/angular2/bundles/router.dev.js"></script>
<script src="../node_modules/angular2/bundles/testing.dev.js"></script>
<script>
// #2. Configure systemjs to use the .js extension
// for imports from the app folder
System.config({
packages: {
'app': {defaultExtension: 'js'},
'src': {defaultExtension: 'js'},
'ng2-alfresco-core': {defaultExtension: 'js'}
}
});
// #3. Import the spec file explicitly
Promise.all([
System.import('test/components/document-list.spec.js')/*,
System.import('app/my-uppercase.pipe.spec')*/
])
// #4. wait for all imports to load ...
// then re-execute `window.onload` which
// triggers the Jasmine test-runner start
// or explain what went wrong.
.then(window.onload)
.catch(console.error.bind(console));
</script>
</body>
</html>