This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 9e92b457 authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Mehr schwache Tests :-(

parent a60dfef2
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
......@@ -13,7 +13,7 @@ pipeline {
nodejs "Node15.11"
}
stages {
stage('Compile and Test') {
stage('Compile and Maven Test') {
steps {
milestone 1
withSonarQubeEnv('SonarQube Production') {
......@@ -21,7 +21,7 @@ pipeline {
}
}
}
stage('Evaluate') {
stage('Evaluate node tests') {
steps {
milestone 2
junit(testResults: 'target/test-results/test/**/*.xml,target/test-results/integrationTest/**/*.xml', healthScaleFactor: 100)
......
......@@ -8,7 +8,7 @@ import { SERVER_API_URL } from 'app/app.constants';
import {GitSearchV2SharedModule} from 'app/shared/shared.module';
import {PagesMarkDownViewerComponent} from 'app/editorialPages/markDownViewer/markDownViewer.component'
class MyRenderer extends MarkedRenderer {
export class MyRenderer extends MarkedRenderer {
public attachmentResourceURL = SERVER_API_URL + 'api/pages/attachment';
image(href: string | null, title: string | null, text: string): string {
......
......@@ -4,13 +4,14 @@ import { PagesComponent } from 'app/editorialPages/pages.component';
import { PagesService } from 'app/shared/service/pages-service';
import { ActivatedRoute, Router, RouterState } from '@angular/router';
import { PagesMarkDownViewerComponent } from 'app/editorialPages/markDownViewer/markDownViewer.component';
import { MarkdownComponent, MarkdownModule, MarkdownService } from 'ngx-markdown';
import { MarkdownComponent, MarkdownModule, MarkdownService, MarkedOptions } from 'ngx-markdown';
import { RouterTestingModule } from '@angular/router/testing';
import { PagesResolve } from 'app/editorialPages/pages.route';
import { Location } from '@angular/common';
import { of } from 'rxjs';
import { By } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { markedOptionsFactory, MyRenderer } from 'app/editorialPages/editorialPages.module';
describe('Component Tests', () => {
describe('Pages Component', () => {
......@@ -41,7 +42,11 @@ describe('Component Tests', () => {
]
}
TestBed.configureTestingModule({
imports: [GitsearchTestModule, MarkdownModule.forRoot(), RouterTestingModule.withRoutes([pagesTestRoutes])],
imports: [GitsearchTestModule, RouterTestingModule.withRoutes([pagesTestRoutes]), MarkdownModule.forRoot({
markedOptions: {
provide: MarkedOptions,
useFactory:markedOptionsFactory,
}})],
declarations: [PagesComponent, PagesMarkDownViewerComponent],
providers: [
MarkdownService,
......@@ -56,7 +61,7 @@ describe('Component Tests', () => {
],
})
.overrideTemplate(PagesComponent, '')
.overrideTemplate(PagesMarkDownViewerComponent, '')
.overrideTemplate(PagesMarkDownViewerComponent, '<div *ngIf="page"><markdown #pageMarkDown ngPreserveWhitespaces [katexOptions]="katexOptions" [data]="page.content" (ready)="fixLinksToGoViaRouter()"></markdown></div>')
.compileComponents();
}));
......@@ -109,14 +114,15 @@ describe('Component Tests', () => {
expect(compMD.page.path).toBe('en/start');
}));
/*
it('check markdown generation', fakeAsync(() => {
// GIVEN
const getPageSpy = spyOn(pagesService, 'getPage').and.callFake((pagePath: string) => {
return of({ path: pagePath, content: "#head\n hello world" });
return of({ path: pagePath, content: "# head\n[Wie stelle ich Inhalte zur Verfügung](de/publishers/howto)\n![image](uploads/78141952f6701c38c37b0bd2d8e01658/image.png)" });
});
let myRenderer = compMarkDown.markdownService.renderer
spyOn(myRenderer as MyRenderer, 'getAttachmentURL').and.returnValue(of('/fake/attachment'));
compMD.ngOnInit();
tick();
......@@ -125,14 +131,19 @@ describe('Component Tests', () => {
fixtureMD.detectChanges();
compMarkDown.data = compMD.page.content;
fixtureMarkDown.detectChanges;
let renderedResult = compMarkDown.render(compMarkDown.data);
fixtureMarkDown.detectChanges();
let nativeElem = fixtureMarkDown.debugElement.nativeElement;
let child0 = nativeElem.children[0];
let child1 = nativeElem.children[1];
let h1 = fixtureMarkDown.debugElement.query(By.css("h1"))
let H1 = fixtureMarkDown.debugElement.query(By.css("H1"))
let innerHtml = fixtureMarkDown.debugElement.nativeElement.innerHtml;
// THEN
}));
*/
});
})
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