Skip to content

Commit

Permalink
test(disabled.directive): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kordrad committed Jul 10, 2024
1 parent ff02cfd commit 02a7c27
Showing 2 changed files with 32 additions and 2 deletions.
4 changes: 4 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,10 @@ export default {
coverageProvider: 'v8',
moduleNameMapper: {
'^@ng-zen/cli/(.*)': '<rootDir>/projects/cli/src/$1',
'^ng-zen/components/(.*)':
'<rootDir>/projects/cli/schematics/components/files/$1',
'^ng-zen/directives/(.*)':
'<rootDir>/projects/cli/schematics/directives/files/$1',
},
preset: 'jest-preset-angular',
testEnvironment: 'jsdom',
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
import { Component } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ZenDisabledDirective } from './disabled.directive';
import { ZenHostDirective } from './index';

@Component({
template: ``,
hostDirectives: [ZenHostDirective],
standalone: true,
})
class ZenDisabledComponent {}

describe('ZenDisabledDirective', () => {
it('should create an instance', () => {
const directive = new ZenDisabledDirective();
let component: ZenDisabledComponent;
let directive: ZenDisabledDirective;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ZenDisabledComponent],
}).compileComponents();

const fixture: ComponentFixture<ZenDisabledComponent> =
TestBed.createComponent(ZenDisabledComponent);
component = fixture.componentInstance;
directive = fixture.debugElement.injector.get(ZenDisabledDirective);
fixture.detectChanges();
});

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

0 comments on commit 02a7c27

Please sign in to comment.