dmester / ngx-jdenticon

Angular directives used to generate identicons using Jdenticon.
https://jdenticon.com/
MIT License
6 stars 1 forks source link

Unexpected value 'NgxJdenticonModule' imported by the module 'DynamicTestModule' #10

Open triadzack opened 2 years ago

triadzack commented 2 years ago

I just updated my angular app and I am seeing this issue when I run my unit tests

Unexpected value 'NgxJdenticonModule' imported by the module 'DynamicTestModule'. Please add an @NgModule annotation.

Related packages

    "@angular/core": "~13.3.5",
    "jdenticon": "^3.1.1",
    "ngx-jdenticon": "^1.0.4",

    "@angular-builders/jest": "13.0.3",
    "jest": "27.5.1",

I looked at the NgxJdenticonModule source and it seems to have an "@NgModule annotation." so I'm not sure whats going on.

The unit test is simple enough

import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { NgxJdenticonModule } from 'ngx-jdenticon';

import { CandidateAvatarComponent } from './candidate-avatar.component';

describe('CandidateAvatarComponent', () => {
    let component: CandidateAvatarComponent;
    let fixture: ComponentFixture<CandidateAvatarComponent>;

    beforeEach(
        waitForAsync(() => {
            TestBed.configureTestingModule({
                declarations: [CandidateAvatarComponent],
                imports: [NgxJdenticonModule],
                schemas: [CUSTOM_ELEMENTS_SCHEMA],
                teardown: { destroyAfterEach: false },
            }).compileComponents();
        })
    );

    beforeEach(() => {
        fixture = TestBed.createComponent(CandidateAvatarComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

    it('CandidateAvatarComponent: should create', () => {
        expect(component).toBeTruthy();
    });
});
triadzack commented 2 years ago

Looking at node_modules/ngx-jdenticon/lib/ngx-jdenticon.module.d.ts The file only contains

export declare class NgxJdenticonModule {
}

This seems to be the issue?