Basic unit test setting

This commit is contained in:
mauriziovitale84
2016-10-10 10:34:31 +01:00
parent d5f37f3e5c
commit 9dc673af08
3 changed files with 32 additions and 14 deletions

View File

@@ -56,6 +56,7 @@ var map = {
'moment' : 'npm:moment/min/moment.min.js', 'moment' : 'npm:moment/min/moment.min.js',
'alfresco-js-api': 'npm:alfresco-js-api/dist', 'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-activiti-analytics': 'npm:ng2-activiti-analytics/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist' 'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist'
}; };
@@ -67,6 +68,7 @@ var packages = {
'moment': { defaultExtension: 'js' }, 'moment': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'}, 'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},
'ng2-activiti-analytics': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'} 'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'}
}; };

View File

@@ -44,6 +44,7 @@ module.exports = function (config) {
// ng2-components // ng2-components
{ pattern: 'node_modules/ng2-alfresco-core/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-activiti-analytics/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-charts/**/*.js', included: false, served: true, watched: false }, { pattern: 'node_modules/ng2-charts/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/moment/**/*.js', included: false, served: true, watched: false }, { pattern: 'node_modules/moment/**/*.js', included: false, served: true, watched: false },

View File

@@ -16,16 +16,30 @@
*/ */
import { ComponentFixture, TestBed, async } from '@angular/core/testing'; import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { AnalyticsComponent } from './analytics.component';
import { DebugElement } from '@angular/core';
import { import {
AlfrescoAuthenticationService,
AlfrescoSettingsService,
AlfrescoApiService,
CoreModule CoreModule
} from 'ng2-alfresco-core'; } from 'ng2-alfresco-core';
describe('Test ng2-alfresco-analytics analytics component ', () => { import { AnalyticsReportListComponent } from '../components/analytics-report-list.component';
import { AnalyticsComponent } from '../components/analytics.component';
import { WIDGET_DIRECTIVES } from '../components/widgets/index';
import { CHART_DIRECTIVES } from 'ng2-charts/ng2-charts';
import { AnalyticsService } from '../services/analytics.service';
import { DebugElement } from '@angular/core';
export const ANALYTICS_DIRECTIVES: any[] = [
AnalyticsComponent,
AnalyticsReportListComponent,
WIDGET_DIRECTIVES
];
export const ANALYTICS_PROVIDERS: any[] = [
AnalyticsService
];
describe('Show component HTML', () => {
let component: any; let component: any;
let fixture: ComponentFixture<AnalyticsComponent>; let fixture: ComponentFixture<AnalyticsComponent>;
@@ -37,25 +51,26 @@ describe('Test ng2-alfresco-analytics analytics component ', () => {
imports: [ imports: [
CoreModule CoreModule
], ],
declarations: [AnalyticsComponent], declarations: [
...ANALYTICS_DIRECTIVES,
...CHART_DIRECTIVES
],
providers: [ providers: [
AlfrescoSettingsService, ...ANALYTICS_PROVIDERS
AlfrescoAuthenticationService,
AlfrescoApiService
] ]
}).compileComponents(); }).compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(AnalyticsComponent); fixture = TestBed.createComponent(AnalyticsComponent);
component = fixture.componentInstance;
debug = fixture.debugElement; debug = fixture.debugElement;
element = fixture.nativeElement; element = fixture.nativeElement;
component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
xit('No test', () => { it('Display component tag base-chart', () => {
}); expect(true).toBe(true);
}); });
});