Commit 4399c6bc authored by Mark Harding's avatar Mark Harding

(fix): failing spec tests

1 merge request!343WIP: Epic/ssr
Pipeline #108425311 failed with stages
in 3 minutes and 40 seconds
......@@ -6,11 +6,14 @@ import {
TestBed,
tick,
} from '@angular/core/testing';
import { DebugElement, EventEmitter } from '@angular/core';
import { DebugElement, EventEmitter, PLATFORM_ID } from '@angular/core';
import { MockComponent, MockDirective, MockService } from '../../../utils/mock';
import { CommonModule as NgCommonModule } from '@angular/common';
import {
CommonModule as NgCommonModule,
ɵPLATFORM_BROWSER_ID,
} from '@angular/common';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Client } from '../../../services/api/client';
......@@ -39,6 +42,7 @@ import { ChannelMode } from '../../../interfaces/entities';
import { ifStmt } from '@angular/compiler/src/output/output_ast';
import { ChannelModulesComponent } from '../modules/modules';
import { SiteService } from '../../../common/services/site.service';
import { IfBrowserDirective } from '../../../common/directives/if-browser.directive';
describe('ChannelSidebar', () => {
let comp: ChannelSidebar;
......@@ -113,6 +117,7 @@ describe('ChannelSidebar', () => {
inputs: ['icon', 'iconClass'],
}),
IfFeatureDirective,
IfBrowserDirective,
],
imports: [FormsModule, RouterTestingModule, NgCommonModule],
providers: [
......@@ -143,6 +148,10 @@ describe('ChannelSidebar', () => {
},
}),
},
{
provide: PLATFORM_ID,
useValue: ɵPLATFORM_BROWSER_ID,
},
],
}).compileComponents(); // compile template and css
}));
......
......@@ -21,6 +21,7 @@ import { contextServiceMock } from '../../../tests/context-service-mock.spec';
import { MockComponent } from '../../utils/mock';
import { OverlayModalService } from '../../services/ux/overlay-modal';
import { overlayModalServiceMock } from '../../../tests/overlay-modal-service-mock.spec';
import { ConfigsService } from '../../common/services/configs.service';
@Component({
selector: 'm-groups--tile',
......@@ -83,7 +84,8 @@ describe('Groups List', () => {
{ provide: Client, useValue: clientMock },
{ provide: MindsTitle, useClass: Title, deps: [Title] },
{ provide: ContextService, useValue: contextServiceMock },
{ provide: Session, useClass: Session },
ConfigsService,
Session,
{ provide: OverlayModalService, useValue: overlayModalServiceMock },
],
}).compileComponents();
......
......@@ -6,7 +6,7 @@ import { fakeAsync, tick } from '@angular/core/testing';
import { mindsTitleMock } from '../../mocks/services/ux/minds-title.service.mock.spec';
import { MockService } from '../../utils/mock';
import { SiteService } from '../../common/services/site.service';
import { EventEmitter } from '@angular/core';
import { EventEmitter, PLATFORM_ID } from '@angular/core';
export let siteServiceMock = new (function() {
var pro = () => null;
......@@ -26,6 +26,7 @@ describe('NewsfeedService', () => {
clientMock,
socketMock,
mindsTitleMock,
PLATFORM_ID,
siteServiceMock
);
clientMock.response = {};
......
......@@ -91,10 +91,12 @@ export class NotificationService {
*/
getNotifications() {
const pollIntervalSeconds = 60;
// this.notificationPollTimer = timer(0, pollIntervalSeconds * 1000);
// this.updateNotificationCountSubscription = this.notificationPollTimer.subscribe(
// () => this.updateNotificationCount()
// );
if (isPlatformBrowser(this.platformId)) {
this.notificationPollTimer = timer(0, pollIntervalSeconds * 1000);
this.updateNotificationCountSubscription = this.notificationPollTimer.subscribe(
() => this.updateNotificationCount()
);
}
}
updateNotificationCount() {
......@@ -125,7 +127,8 @@ export class NotificationService {
this.title.setCounter(window.Minds.notifications_count);
}
// ngOnDestroy() {
// this.updateNotificationCountSubscription.unsubscribe();
// }
ngOnDestroy() {
if (this.updateNotificationCountSubscription)
this.updateNotificationCountSubscription.unsubscribe();
}
}
/**
* Sessions
*/
import { EventEmitter } from '@angular/core';
import { EventEmitter, Injectable } from '@angular/core';
import { ConfigsService } from '../common/services/configs.service';
@Injectable()
export class Session {
loggedinEmitter: EventEmitter<any> = new EventEmitter();
userEmitter: EventEmitter<any> = new EventEmitter();
......
Please register or to comment