Skip to content

Commit 38d6def

Browse files
committed
Fix tests and linting
1 parent 4e5eefb commit 38d6def

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

projects/admin-core/src/lib/catalog/catalog.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { CatalogShortcutButtonsComponent } from './catalog-shortcut-buttons/cata
4242
import { FeatureTypeTemplateComponent } from './feature-type-template/feature-type-template.component';
4343
import { ProjectionAvailabilityComponent } from './projection-availability/projection-availability.component';
4444
import {
45-
FeatureTypeAttachmentAttributesComponent
45+
FeatureTypeAttachmentAttributesComponent,
4646
} from './feature-type-attachment-attributes/feature-type-attachment-attributes.component';
4747

4848

projects/admin-core/src/lib/catalog/feature-type-details/feature-type-details.component.spec.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ import { SaveButtonComponent } from '../../shared/components/save-button/save-bu
1515
import { FeatureTypeFormComponent } from '../feature-type-form/feature-type-form.component';
1616
import { SpinnerButtonComponent } from '@tailormap-viewer/shared';
1717
import { CatalogExtendedTypeEnum } from '../models/catalog-extended.model';
18+
import {
19+
FeatureTypeAttachmentAttributesComponent
20+
} from '../feature-type-attachment-attributes/feature-type-attachment-attributes.component';
21+
import { MatIconTestingModule } from '@angular/material/icon/testing';
1822

1923
const setup = async () => {
2024
const activeRoute = {
@@ -37,6 +41,7 @@ const setup = async () => {
3741
originalId: 'ft_1',
3842
featureSourceId: '1',
3943
catalogNodeId: 'node-1',
44+
featureSourceProtocol: FeatureSourceProtocolEnum.JDBC,
4045
};
4146
const featureSourceModel: ExtendedFeatureSourceModel = {
4247
...getFeatureSource({ id: '1', title: 'JDBC source', protocol: FeatureSourceProtocolEnum.JDBC }),
@@ -60,8 +65,14 @@ const setup = async () => {
6065
};
6166
const store = createMockStore({ initialState: { [catalogStateKey]: catalogState } });
6267
await render(FeatureTypeDetailsComponent, {
63-
declarations: [ FeatureTypeFormComponent, FeatureTypeAttributesComponent, SaveButtonComponent, SpinnerButtonComponent ],
64-
imports: [SharedModule],
68+
declarations: [
69+
FeatureTypeFormComponent,
70+
FeatureTypeAttributesComponent,
71+
FeatureTypeAttachmentAttributesComponent,
72+
SaveButtonComponent,
73+
SpinnerButtonComponent,
74+
],
75+
imports: [ SharedModule, MatIconTestingModule ],
6576
providers: [
6677
{ provide: ActivatedRoute, useValue: activeRoute },
6778
{ provide: FeatureSourceService, useValue: featureSourceService },

projects/admin-core/src/lib/catalog/feature-type-form/feature-type-form.component.spec.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
11
import { render, screen } from '@testing-library/angular';
22
import { FeatureTypeFormComponent } from './feature-type-form.component';
33
import { of } from 'rxjs';
4-
import { getFeatureTypeSummary } from '@tailormap-admin/admin-api';
4+
import { FeatureTypeModel } from '@tailormap-admin/admin-api';
55
import { SharedModule } from '@tailormap-viewer/shared';
6-
import { ExtendedFeatureTypeModel } from '../models/extended-feature-type.model';
76
import { FeatureSourceService } from '../services/feature-source.service';
87
import { FeatureTypeAttributesComponent } from '../feature-type-attributes/feature-type-attributes.component';
98
import { SaveButtonComponent } from '../../shared/components/save-button/save-button.component';
109
import { SpinnerButtonComponent } from '@tailormap-viewer/shared';
11-
import { CatalogExtendedTypeEnum } from '../models/catalog-extended.model';
1210
import { createMockStore } from '@ngrx/store/testing';
1311
import { catalogStateKey, initialCatalogState } from '../state/catalog.state';
1412
import { Store } from '@ngrx/store';
13+
import {
14+
FeatureTypeAttachmentAttributesComponent,
15+
} from '../feature-type-attachment-attributes/feature-type-attachment-attributes.component';
16+
import { MatIconTestingModule } from '@angular/material/icon/testing';
1517

1618
const setup = async () => {
1719
const featureSourceService = { updateFeatureSource$: jest.fn(() => of({})) };
18-
const featureTypeModel: ExtendedFeatureTypeModel = {
19-
...getFeatureTypeSummary({ name: 'ft_1', title: 'some table' }),
20+
const featureTypeModel: FeatureTypeModel = {
21+
attributes: [],
22+
defaultGeometryAttribute: null,
23+
primaryKeyAttribute: null,
24+
settings: {
25+
attributeSettings: {},
26+
},
2027
id: '1_ft_1',
21-
originalId: 'ft_1',
22-
featureSourceId: '1',
23-
catalogNodeId: 'node-1',
24-
type: CatalogExtendedTypeEnum.FEATURE_TYPE_TYPE,
28+
name: 'ft_1',
29+
title: 'some table',
2530
};
2631
const mockStore = createMockStore({
2732
initialState: { [catalogStateKey]: { ...initialCatalogState } },
2833
});
2934
await render(FeatureTypeFormComponent, {
30-
declarations: [ FeatureTypeAttributesComponent, SaveButtonComponent, SpinnerButtonComponent ],
31-
imports: [SharedModule],
35+
declarations: [
36+
FeatureTypeAttributesComponent,
37+
FeatureTypeAttachmentAttributesComponent,
38+
SaveButtonComponent,
39+
SpinnerButtonComponent,
40+
],
41+
imports: [ SharedModule, MatIconTestingModule ],
3242
inputs: {
3343
featureType: featureTypeModel,
3444
},

0 commit comments

Comments
 (0)