Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with MockBuilder and @angular/cdk DragDropModule #173

Closed
cdupetit opened this issue Jul 20, 2020 · 5 comments · Fixed by #174
Closed

Error with MockBuilder and @angular/cdk DragDropModule #173

cdupetit opened this issue Jul 20, 2020 · 5 comments · Fixed by #174

Comments

@cdupetit
Copy link

Hi @satanTime,
When I use MockBuilder to test an application with DragDropModule from @angular/cdk.
I get this error :

Error: Unexpected value '[object Object]' exported by the module 'MockOfDragDropModule'

The test run correctly if I use keep(DragDropModule).
You can see the error in StackBlitz.
The code works fine in production.

angular.json
Production :
projects -> demo -> architect -> build -> options -> main -> src/main.ts
Testing :
projects -> demo -> architect -> build -> options -> main -> src/main-testing.ts

Thanks in advance.
Best regards.
Cyril

@satanTime
Copy link
Member

Hi again :)

Thanks for the report, I'll take a look tonight and I'll try to provide a fix today or later this week.

@satanTime
Copy link
Member

Min test:

"@angular/cdk": "10.0.2",
"@angular/material": "10.0.2",
import { MockBuilder, MockRender } from 'ng-mocks';
import { DragDropModule } from '@angular/cdk/drag-drop';

import { Component, NgModule } from '@angular/core';

@Component({
  selector: 'app-root',
  template: 'ng-mocks',
})
export class AppComponent {
}

@NgModule({
  imports: [
    DragDropModule,
  ],
  declarations: [AppComponent],
})
export class AppModule {
}

describe('AppComponent', () => {
  describe('mock DragDropModule', () => {
    beforeEach(() => MockBuilder(AppComponent, AppModule));

    it('should create the app', () => {
      expect(() => MockRender(AppComponent)).not.toThrow();
    });
  });
});

@satanTime
Copy link
Member

Hi @cdupetit,

might you verify that the new build ng-mocks.zip runs on your tests as expected?

@cdupetit
Copy link
Author

Hi @cdupetit,

might you verify that the new build ng-mocks.zip runs on your tests as expected?

Hi @satanTime,
This version fix the error and runs tests as expected.
Thanks.
Best regards.

@satanTime
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants