Skip to content

Commit

Permalink
chore(#8554): error on missing components
Browse files Browse the repository at this point in the history
  • Loading branch information
garethbowen committed Oct 24, 2023
1 parent 0b907e1 commit eaf13d0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion webapp/src/ts/modules/modules.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatMenuModule } from '@angular/material/menu';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatExpansionModule} from '@angular/material/expansion';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatDialogModule } from '@angular/material/dialog';

import { PipesModule } from '@mm-pipes/pipes.module';
Expand Down
7 changes: 5 additions & 2 deletions webapp/tests/karma/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ chai.config.truncateThreshold = 0;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
platformBrowserDynamicTesting(),
{
errorOnUnknownElements: true,
errorOnUnknownProperties: true
}
);

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import { RelativeDatePipe } from '@mm-pipes/date.pipe';
import { FastActionButtonService } from '@mm-services/fast-action-button.service';
import { DbService } from '@mm-services/db.service';
import { SendMessageComponent } from '@mm-modals/send-message/send-message.component';
import { FastActionButtonComponent } from '@mm-components/fast-action-button/fast-action-button.component';
import { NgIf } from '@angular/common';
import { AuthService } from '@mm-services/auth.service';
import { SessionService } from '@mm-services/session.service';
import { MatBottomSheet } from '@angular/material/bottom-sheet';
import { MatDialog } from '@angular/material/dialog';

describe('Reports Content Component', () => {
let component: ReportsContentComponent;
Expand All @@ -39,6 +45,8 @@ describe('Reports Content Component', () => {
let medicDb;
let dbService;
let modalService;
let authService;
let sessionService;

beforeEach(waitForAsync(() => {
const mockedSelectors = [
Expand All @@ -58,19 +66,22 @@ describe('Reports Content Component', () => {
medicDb = { get: sinon.stub().resolves() };
dbService = { get: sinon.stub().returns(medicDb) };
modalService = { show: sinon.stub() };
authService = { isAdmin: sinon.stub() };

return TestBed
.configureTestingModule({
imports: [
TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } }),
RouterTestingModule,
NgIf
],
declarations: [
ReportsContentComponent,
EditMessageGroupComponent,
FormIconPipe,
TitlePipe,
RelativeDatePipe,
FastActionButtonComponent
],
providers: [
provideMockStore({ selectors: mockedSelectors }),
Expand All @@ -85,6 +96,10 @@ describe('Reports Content Component', () => {
{ provide: ResourceIconPipe, useValue: { transform: sinon.stub() } },
{ provide: FastActionButtonService, useValue: fastActionButtonService },
{ provide: DbService, useValue: dbService },
{ provide: AuthService, useValue: authService },
{ provide: SessionService, useValue: sessionService },
{ provide: MatBottomSheet, useValue: { open: sinon.stub() } },
{ provide: MatDialog, useValue: { open: sinon.stub() } },
]
})
.compileComponents()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { GlobalActions } from '@mm-actions/global';
import { ReportsMoreMenuComponent } from '@mm-modules/reports/reports-more-menu.component';
import { MatBottomSheet } from '@angular/material/bottom-sheet';
import { MatDialog } from '@angular/material/dialog';
import { CommonModule } from '@angular/common';
import { MatExpansionModule } from '@angular/material/expansion';

describe('Reports More Menu Component', () => {
let component: ReportsMoreMenuComponent;
Expand Down Expand Up @@ -45,6 +47,8 @@ describe('Reports More Menu Component', () => {
.configureTestingModule({
imports: [
TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } }),
MatExpansionModule,
CommonModule
],
providers: [
provideMockStore({ selectors: mockedSelectors }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import { BulkDeleteConfirmComponent } from '@mm-modals/bulk-delete-confirm/bulk-
import { FastActionButtonService } from '@mm-services/fast-action-button.service';
import { FeedbackService } from '@mm-services/feedback.service';
import { XmlFormsService } from '@mm-services/xml-forms.service';
import { ReportsMoreMenuComponent } from '@mm-modules/reports/reports-more-menu.component';
import { MatExpansionModule } from '@angular/material/expansion';

describe('Reports Component', () => {
let component: ReportsComponent;
Expand Down Expand Up @@ -89,6 +91,7 @@ describe('Reports Component', () => {
authService = {
has: sinon.stub().resolves(false),
online: sinon.stub().resolves(false),
any: sinon.stub().resolves(true)
};
sessionService = {
isAdmin: sinon.stub().returns(false),
Expand Down Expand Up @@ -122,13 +125,15 @@ describe('Reports Component', () => {
ComponentsModule,
BrowserAnimationsModule,
BsDropdownModule.forRoot(),
MatExpansionModule
],
declarations: [
ReportsComponent,
ReportsFiltersComponent,
ReportsSidebarFilterComponent,
SearchBarComponent,
ReportsContentComponent,
ReportsMoreMenuComponent,
NavigationComponent,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { DbService } from '@mm-services/db.service';
import { FeedbackService } from '@mm-services/feedback.service';
import { SessionService } from '@mm-services/session.service';
import { TestingComponent } from '@mm-modules/testing/testing.component';
import { FormsModule } from '@angular/forms';

describe('Testing Component', () => {
let component: TestingComponent;
Expand Down Expand Up @@ -38,7 +39,8 @@ describe('Testing Component', () => {
return TestBed
.configureTestingModule({
imports: [
TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } })
TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } }),
FormsModule
],
declarations: [
TestingComponent
Expand Down

0 comments on commit eaf13d0

Please sign in to comment.