SearchService should be created FAILED. TypeError: Cannot read property ‘ngModule’ of null

I am trying to unit test a service in my modules directory for my website. However, when I npm test it, it gives me this error:

Chrome 86.0.4240.80 (Mac OS 10.15.7) SearchService should be created FAILED
    TypeError: Cannot read property 'ngModule' of null
        at isModuleWithProviders (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:26155:1)
        at expandModuleWithProviders (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:26149:1)
        at <Jasmine>
        at Function.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:25805:1)
        at getNgModuleDef (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:1842:1)
        at verifySemanticsOfNgModuleDef (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:25860:1)
        at Function.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:25828:1)
        at R3TestBedCompiler.applyProviderOverridesToModule (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:1331:1)
        at R3TestBedCompiler.compileTestModule (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:1576:1)
        at R3TestBedCompiler.finalize (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:1185:1)
    Error: Expected undefined to be truthy.
        at <Jasmine>
        at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/src/app/modules/dashboard/services/search.service.spec.ts:21:21)
Chrome 86.0.4240.80 (Mac OS 10.15.7): Executed 1 of 1 (1 FAILED) (1.514 secs / 1.5 secs)
TOTAL: 1 FAILED, 0 SUCCESS

My search.service.spec.ts is pretty much a skeleton:

import { TestBed } from '@angular/core/testing';
import { SearchService } from './search.service';
import { HttpClientModule } from '@angular/common/http';

describe('SearchService', () => {
  let service: SearchService;
  let mockSearchService = jasmine.createSpyObj('searchService', ['search']);
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers:[
        {provide: SearchService, useValue: mockSearchService}
      ],
      imports: [HttpClientModule],
    });
    service = TestBed.inject(SearchService);
  });

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

The module.ts is also pretty bare. According to the Angular documentation, services should be put in the providers portion of NgModule and I’m not sure if I am supposed to import it or not at the top.

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { SharedModule } from '@shared/shared.module';
import { SearchService } from './services';

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        SharedModule,
        ReactiveFormsModule,
    ],
    declarations: [
    ],
    entryComponents: [
    ],
    providers: [SearchService],
    exports: [],
})

export class DashBoardModule {}

Any help would be appreciated.

Source: Angular Questions