Skip to content

Commit

Permalink
chore(tests): tests fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Celtian committed May 24, 2024
1 parent 43ed089 commit 11988df
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 65 deletions.
1 change: 0 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/demo/src/test.ts",
"polyfills": "projects/demo/src/polyfills.ts",
"tsConfig": "projects/demo/tsconfig.spec.json",
"karmaConfig": "projects/demo/karma.conf.js",
"assets": [
Expand Down
13 changes: 7 additions & 6 deletions projects/demo/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { provideExperimentalZonelessChangeDetection } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NgxAppVersionOptions, provideAppVersion } from 'projects/ngx-app-version/src/public-api';
import { AppComponent } from './app.component';

Expand All @@ -10,23 +11,23 @@ describe('AppComponent', () => {
version: '1.0.0'
};

beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [AppComponent],
providers: [provideAppVersion(mockOptions)]
providers: [provideExperimentalZonelessChangeDetection(), provideAppVersion(mockOptions)]
}).compileComponents();

fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
}));
});

it('should create the app', () => {
expect(component).toBeTruthy();
});

it(`should get github link`, waitForAsync(() => {
it(`should get github link`, () => {
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('.github-logo').href).toContain('https://github.com/celtian/ngx-app-version');
}));
});
});
52 changes: 0 additions & 52 deletions projects/demo/src/polyfills.ts

This file was deleted.

1 change: 0 additions & 1 deletion projects/demo/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';

Expand Down
2 changes: 1 addition & 1 deletion projects/demo/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"outDir": "../../out-tsc/app",
"types": []
},
"files": ["src/main.ts", "src/polyfills.ts"],
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts"],
}
2 changes: 1 addition & 1 deletion projects/demo/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"outDir": "../../out-tsc/spec",
"types": ["jasmine", "node"]
},
"files": ["src/test.ts", "src/polyfills.ts"],
"files": ["src/test.ts"],
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"],
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ElementRef, Renderer2 } from '@angular/core';
import { Component, ElementRef, Renderer2, provideExperimentalZonelessChangeDetection } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { NgxAppVersionDirective } from './ngx-app-version.directive';
Expand All @@ -24,6 +24,7 @@ describe('NgxAppVersionDirective', () => {
declarations: [TestComponent],
imports: [NgxAppVersionDirective],
providers: [
provideExperimentalZonelessChangeDetection(),
provideAppVersion(mockOptions),
{ provide: ElementRef, useValue: {} },
{ provide: Renderer2, useValue: {} }
Expand Down Expand Up @@ -64,6 +65,7 @@ describe('NgxAppVersionDirective', () => {
declarations: [TestHostComponent],
imports: [],
providers: [
provideExperimentalZonelessChangeDetection(),
provideAppVersion(mockOptions),
{ provide: ElementRef, useValue: {} },
{ provide: Renderer2, useValue: {} }
Expand Down
2 changes: 0 additions & 2 deletions projects/ngx-app-version/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';

Expand Down

0 comments on commit 11988df

Please sign in to comment.