The module 'DynamicTestModule' experienced an import of an unexpected value under the name 'SohoComponentsModule'

I have been working on an angular 2 application using our UI team's library. The progress has been smooth, thanks to the easy integration of their components through import statements in my app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { SohoComponentsModule } from '@infor/sohoxi-angular'; // This is where the issue arises.

import { AppComponent } from './app.component';
import { licenseGeneratorComponent } from './licenseGenerator.component';
import { emergencyLicenseComponent } from './tabs/emergency/emergencyLicense.component';
import { partnerLicenseComponent } from './tabs/partner/partnerLicense.component';
import { standardLicenseComponent } from './tabs/standard/standardLicense.component';

@NgModule({
  declarations: [
    AppComponent,
    licenseGeneratorComponent,
    emergencyLicenseComponent,
    partnerLicenseComponent,
    standardLicenseComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    SohoComponentsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

One of the templates within the app uses the Soho library components:

<div class="row">
  <div class="twelve columns">
  <h1>License Generator</h1>
    <div soho-tabs>
      <ul soho-tab-list>
        <li soho-tab><a soho-tab-title tabId='tabs-normal-emergency'>Emergency Licenses</a></li>
        <li soho-tab><a soho-tab-title tabId='tabs-normal-partner'>Partner Licenses</a></li>
        <li soho-tab><a soho-tab-title tabId='tabs-normal-standard'>Standard Licenses</a></li>
      </ul;

      <div soho-tab-panel tabId='tabs-normal-emergency'>
        <emergency-license></emergency-license>
      </div>
      <div soho-tab-panel tabId='tabs-normal-partner'>
        <partner-license></partner-license>
      </div>
      <div soho-tab-panel tabId='tabs-normal-standard'>
        <standard-license></standard-license>
      </div>
    </div>
  </div>
</div>

While the application itself runs fine, I encountered issues with my unit tests. Initially they worked but after revisiting them following content additions, the tests started failing.

Running the tests triggers this error:

Unexpected value 'SohoComponentsModule' imported by the module 'DynamicTestModule'

Here's a snippet from my app.component.spec:

import { TestBed, async } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { licenseGeneratorComponent } from './licenseGenerator.component';
import { emergencyLicenseComponent } from './tabs/emergency/emergencyLicense.component';
import { partnerLicenseComponent } from './tabs/partner/partnerLicense.component';
import { standardLicenseComponent } from './tabs/standard/standardLicense.component';

import { SohoComponentsModule } from '@infor/sohoxi-angular';

describe('AppComponent', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [
        AppComponent,
        licenseGeneratorComponent,
        emergencyLicenseComponent,
        partnerLicenseComponent,
        standardLicenseComponent,
      ],
      imports: [
        FormsModule,
        SohoComponentsModule
      ],
    });
  });

  it('should create the app', async(() => {
    let fixture = TestBed.createComponent(AppComponent);
    let app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  }));

  it(`should have as title 'app works!'`, async(() => {
    let fixture = TestBed.createComponent(AppComponent);
    let app = fixture.debugElement.componentInstance;
    expect(app.title).toEqual('app works!');
  }));
});

I'm currently stuck as removing the import statement in the test leads to new errors:

Can't bind to 'closeOnSelect' since it isn't a known property of 'select'. ("label required">Versions</label>

If anyone can provide guidance or solutions, it would be greatly appreciated.

Please feel free to ask for additional files if needed. Thank you, Chris

Answer №1

The problem was actually related to the Angular library. After updating the library version, the issue was successfully resolved.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The usage of @Inject('Window') in Angular/Jasmine leads to test failures, but removing it results in code failures

Currently, I am encountering a dilemma related to using Angular's @Inject('Window') within a web API service. This particular issue arises when the Window injection is utilized in the service constructor, leading to test spec failures in the ...

The concept of Material Design: Utilizing a grid system with automatic card height

Is there a way to create a grid with cards that have auto height, similar to this example: https://i.sstatic.net/2y87g.png I am currently using Material Design and Angular 4, but I am also open to solutions involving React or VueJS. I have tried using th ...

The speed of the Ionic app is disappointingly sluggish on devices, causing significant delays

After testing my app in Ionic Lab, it runs smoothly. However, when I create the apk file and install it on my device, the performance is very slow. There are delays in clicking on buttons, pushing pages, opening modals, and closing modals. It seems like t ...

Can data be transmitted in Angular without using a selector?

I am facing a challenge in sending data from a child component to its parent. The parent component's HTML code does not utilize the child's selector, as it is within a dialog of Angular Material and only uses "MatDialogRef" and "dialog.open()". T ...

Angular 4 - Seeking clarification on the usage of *ngComponentOutlet

When using *ngComponentOutlet, the following code snippets are employed to handle the displaying: Below is a snippet of functional code: this.displayComponent({ 'objects':[ {component: ToDisplayAComponent, expanded: fals ...

AWS CodePipeline encounters a failure with the error message: "Debug Failure. A non-string value has been passed to `ts.resolveTypeReferenceDirective`."

Everything was running smoothly, but suddenly after pushing some changes, my pipeline started failing consistently. The code works fine on my local machine, so I'm not sure what triggered this sudden issue. Here's the error message from the faile ...

Avoid unwanted typeof warnings in TypeScript and WebStorm combination

How can I handle unwanted TypeScript checks related to JavaScript usage in today's development environment? Consider the following function: function connect(config: string): void { // Getting warning for the line that follows: // typeof ...

Angular Material throws errors when there are missing dependencies

I encountered an issue while trying to set up angular material in my project: Uncaught TypeError: Object(...) is not a function at bidi.es5.js:87 at Object../node_modules/@angular/cdk/esm5/bidi.es5.js (bidi.es5.js:89) at webpack_requir ...

Having trouble with the Angular 2 router event not triggering on the initial try?

When navigating from one component to another, I want to access the URL of the previous route once the new route has been reached. In the constructor of the component being navigated to, I have included the code below. However, I am facing an issue where t ...

Ways to swap out element within ViewContainerRef in Angular

I am currently expanding my knowledge of Angular and I have encountered a challenge regarding dynamically creating components and swapping them within a single container. Here is the setup: <ng-container #container></ng-container> Here are the ...

Modifying Views on the Fly with Ionic 2

When the toggle button on the page is clicked, the current page view will switch to a different HTML layout. I attempted to modify @Page, but after it loads once, I am unable to change it again. @Page({ templateUrl: isTrue ? 'build/pages/detail/ ...

Is it possible to transform a reference to a React Component into JSON format?

I am looking to serialize the state of a React component into JSON format and save it in a database. Here is the current structure of my code: const [exampleState, setExampleState] = useState([ { componentName: "Test component", co ...

Modal for Firestore CRUD operations update()

Currently seeking assistance with a CRUD system that involves modal dialogues. I have successfully implemented adding and deleting functionalities, but I am encountering an issue with editing. Although I can retrieve the data for each record in its respect ...

Using const enums across multiple files with react-scripts-ts

Within our project, we have two distinct subprojects (backend and frontend) that are compiled independently. The frontend utilizes react-scripts-ts, so it is crucial to avoid cross-imports between the two subprojects to maintain the integrity of the transp ...

Regex for US zip code with an optional format

Searching for a regular expression to validate US zip codes. I have come across multiple examples, but none of them cater to the scenario where the zip code is optional. The input field I am working on does not require a zip code, so it should accept a 5 ...

Sending a POST request with parameters using HttpClient

My current challenge involves making a POST request to an endpoint that requires query string parameters instead of passing them in the body of the request. const params = new HttpParams() .set('param1', '1') .set('param2' ...

Transferring FormArray validators from a child component to a parent component in Angular version 8

UPDATE: I successfully implemented data passthrough and validation by refactoring the email-phone-input.component.ts to utilize ControlContainer, obtain the FormGroup from the parent component, and manage FormArray controls. Stay tuned for the updated repo ...

Executing a series of promises sequentially and pausing to finish execution

I have been attempting to run a loop where a promise and its respective then method are created for each iteration. My goal is to only print 'Done' once all promises have been executed in order. However, no matter what I try, 'done' alw ...

Is it recommended to include modules in the Imports section of SharedModule in Angular?

Welcome to my SharedModule! import { CommonModule } from "@angular/common"; import { NgModule } from "@angular/core"; import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { IconModule } from "@my-app/components/icon/icon.module"; impo ...

Localization of labels and buttons in Angular Owl Date Time Picker is not supported

When using the Owl Date Time Picker, I noticed that the From and To labels, as well as the Set and Cancel buttons are not being localized. Here is the code snippet I am using to specify the locale: constructor( private dateTimeAdapter: DateTimeAdapter&l ...