0

I created a class named Query in query.ts

export class Query { 
   constructor(params?) {...}
}

then i created in the same folder query.spec.ts

import { Query } from './query';

fdescribe('Query Model', () => {
    let query: Query;

    beforeEach(() => {
        query = new Query({});
    });

    it('should be created Query Model', () => {
        expect(query).toBeTruthy();
    });
});

but i keep getting this error

TypeError: _query__WEBPACK_IMPORTED_MODULE_0__.Query is not a constructor

iam working with Angular 12 and karma-jasmine any idea what i am doing wrong?

2
  • Could it be how you're importing it? stackoverflow.com/a/60893655/7365461 Commented Apr 13, 2022 at 12:49
  • no since i am not using export default class then the import should be in {} Commented Apr 14, 2022 at 21:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.