fix test and coverage Angular2 Final release core component #749

This commit is contained in:
Eugenio Romano
2016-10-05 13:40:21 +01:00
parent fa456f348c
commit e19b847400
5 changed files with 23 additions and 71 deletions

View File

@@ -53,19 +53,7 @@ var map = {
'rxjs': 'npm:rxjs', 'rxjs': 'npm:rxjs',
'ng2-translate': 'npm:ng2-translate', 'ng2-translate': 'npm:ng2-translate',
'alfresco-js-api': 'npm:alfresco-js-api/dist', 'alfresco-js-api': 'npm:alfresco-js-api/dist'
'ng2-activiti-form': 'npm:ng2-activiti-form/dist',
'ng2-activiti-processlist': 'npm:ng2-activiti-processlist/dist',
'ng2-activiti-tasklist': 'npm:ng2-activiti-tasklist/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist',
'ng2-alfresco-datatable': 'npm:ng2-alfresco-datatable/dist',
'ng2-alfresco-documentlist': 'npm:ng2-alfresco-documentlist/dist',
'ng2-alfresco-login': 'npm:ng2-alfresco-login/dist',
'ng2-alfresco-search': 'npm:ng2-alfresco-search/dist',
'ng2-alfresco-tag': 'npm:ng2-alfresco-tag/dist',
'ng2-alfresco-upload': 'npm:ng2-alfresco-upload/dist',
'ng2-alfresco-viewer': 'npm:ng2-alfresco-viewer/dist',
'ng2-alfresco-webscript': 'npm:ng2-alfresco-webscript/dist'
}; };
var packages = { var packages = {
@@ -73,19 +61,7 @@ var packages = {
'rxjs': { defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' }, 'ng2-translate': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'}, 'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'}
'ng2-activiti-form': { main: './index.js', defaultExtension: 'js'},
'ng2-activiti-processlist': { main: './index.js', defaultExtension: 'js'},
'ng2-activiti-tasklist': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-datatable': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-documentlist': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-login': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-search': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-tag': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-upload': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-viewer': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-webscript': { main: './index.js', defaultExtension: 'js'}
}; };
var config = { var config = {

View File

@@ -43,20 +43,6 @@ module.exports = function (config) {
{pattern: 'dist/**/*.html', included: true, served: true, watched: true}, {pattern: 'dist/**/*.html', included: true, served: true, watched: true},
{pattern: 'dist/**/*.css', included: true, served: true, watched: true}, {pattern: 'dist/**/*.css', included: true, served: true, watched: true},
// ng2-components
{ pattern: 'node_modules/ng2-activiti-form/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-activiti-processlist/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-activiti-tasklist/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-documentlist/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-login/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-search/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-tag/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-upload/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-viewer/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-webscript/dist/**/*.js', included: false, served: true, watched: false },
// paths to support debugging with source maps in dev tools // paths to support debugging with source maps in dev tools
{pattern: 'src/**/*.ts', included: false, watched: false}, {pattern: 'src/**/*.ts', included: false, watched: false},
{pattern: 'dist/**/*.js.map', included: false, watched: false} {pattern: 'dist/**/*.js.map', included: false, watched: false}
@@ -107,7 +93,7 @@ module.exports = function (config) {
// Source files that you wanna generate coverage for. // Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul) // Do not include tests or libraries (these files will be instrumented by Istanbul)
preprocessors: { preprocessors: {
//'dist/**/!(*spec).js': ['coverage'] 'dist/**/!(*spec).js': ['coverage']
}, },
coverageReporter: { coverageReporter: {

View File

@@ -62,14 +62,14 @@
"@angular/platform-browser-dynamic": "2.0.0", "@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0", "@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0", "@angular/upgrade": "2.0.0",
"@types/node": "^6.0.42",
"alfresco-js-api": "^0.3.0",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"ng2-translate": "2.5.0",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12", "rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27", "systemjs": "0.19.27",
"zone.js": "^0.6.23", "zone.js": "^0.6.23"
"alfresco-js-api": "^0.3.0",
"ng2-translate": "2.5.0"
}, },
"devDependencies": { "devDependencies": {
"@types/core-js": "^0.9.32", "@types/core-js": "^0.9.32",

View File

@@ -15,18 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
/* import { ReflectiveInjector } from '@angular/core';
import { inject, TestBed } from '@angular/core/testing';
import { RenditionsService } from './renditions.service';
import { AlfrescoApiService } from './AlfrescoApi.service'; import { AlfrescoApiService } from './AlfrescoApi.service';
import { AlfrescoSettingsService } from './AlfrescoSettings.service'; import { RenditionsService } from './renditions.service';
import { AlfrescoAuthenticationService } from './AlfrescoAuthentication.service';
declare let AlfrescoApi: any;
declare let jasmine: any; declare let jasmine: any;
declare let AlfrescoApi: any;
describe('RenditionsService', () => { describe('RenditionsService', () => {
let service: any; let service, injector;
let fakeRedition = { let fakeRedition = {
'entry': { 'entry': {
@@ -84,30 +81,23 @@ describe('RenditionsService', () => {
}] }]
} }
}; };
beforeEach(() => {
injector = ReflectiveInjector.resolveAndCreate([
AlfrescoApiService,
RenditionsService
]);
});
beforeEach(() => { beforeEach(() => {
jasmine.Ajax.install();
TestBed.configureTestingModule({ service = injector.get(RenditionsService);
providers: [ service.apiService.setInstance(new AlfrescoApi({}));
AlfrescoSettingsService,
AlfrescoApiService,
AlfrescoAuthenticationService,
RenditionsService
]
});
inject([RenditionsService, AlfrescoApiService], (renditionsService: RenditionsService, apiService: AlfrescoApiService) => {
jasmine.Ajax.install();
service = renditionsService;
apiService.setInstance(new AlfrescoApi({}));
});
}); });
afterEach(() => { afterEach(() => {
jasmine.Ajax.uninstall(); jasmine.Ajax.uninstall();
}); });
it('Get redition list service should call the server with the ID passed', (done) => { it('Get redition list service should call the server with the ID passed', (done) => {
service.getRenditionsListByNodeId('fake-node-id').subscribe((res) => { service.getRenditionsListByNodeId('fake-node-id').subscribe((res) => {
expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://127.0.0.1:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions'); expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://127.0.0.1:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions');
@@ -176,4 +166,4 @@ describe('RenditionsService', () => {
}); });
}); });
}); });
*/

View File

@@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"module": "system", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
@@ -16,7 +16,7 @@
"noImplicitUseStrict": false, "noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"outDir": "dist", "outDir": "dist",
"types": ["core-js", "jasmine"] "types": ["core-js", "jasmine", "node"]
}, },
"exclude": [ "exclude": [
"demo", "demo",