Skip to content

Commit

Permalink
test: added dependencies for query services
Browse files Browse the repository at this point in the history
  • Loading branch information
torbrenner committed Feb 9, 2024
1 parent 7159f76 commit ceac14d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {
CATALOGUE_FETCHER_TOKEN,
Category,
ChipTransformPipe,
LensConfig,
LENS_CONFIG_TOKEN,
QUERY_TRANSLATOR_TOKEN,
RESULT_TRANSFORMER_TOKEN,
STATIC_CATALOGUE_TOKEN,
TypescriptCatalogueFetcherService
} from '@samply/lens-core';

import { ResultRendererGridComponent } from './result-renderer-grid.component';
import { ResultRendererGridDirective } from './result-renderer-grid.directive';

const STATIC_CATALOGUE: Array<Category> = [];

describe('ResultRendererGridComponent', () => {
let component: ResultRendererGridComponent;
let fixture: ComponentFixture<ResultRendererGridComponent>;

beforeEach(async () => {
let queryTranslatorSpy = jasmine.createSpyObj(['transform']);
let resultTransformerSpy = jasmine.createSpyObj(['transform']);
await TestBed.configureTestingModule({
declarations: [ ResultRendererGridComponent, ResultRendererGridDirective ]
declarations: [ ResultRendererGridComponent, ResultRendererGridDirective ],
imports: [HttpClientTestingModule],
providers: [{
provide: QUERY_TRANSLATOR_TOKEN,
useValue: queryTranslatorSpy
},{
provide: RESULT_TRANSFORMER_TOKEN,
useValue: resultTransformerSpy
},{
provide: LENS_CONFIG_TOKEN,
useValue: new LensConfig()
},{
provide: ChipTransformPipe
},{
provide: CATALOGUE_FETCHER_TOKEN,
useClass: TypescriptCatalogueFetcherService
},{
provide: STATIC_CATALOGUE_TOKEN,
useValue: STATIC_CATALOGUE
}]
})
.compileComponents();

fixture = TestBed.createComponent(ResultRendererGridComponent);

component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ResultRendererGridComponent } from './result-renderer-grid.component';
import {
CATALOGUE_FETCHER_TOKEN,
Category,
ChipTransformPipe,
LensConfig,
LENS_CONFIG_TOKEN,
QUERY_TRANSLATOR_TOKEN,
RESULT_TRANSFORMER_TOKEN,
STATIC_CATALOGUE_TOKEN,
TypescriptCatalogueFetcherService
} from '@samply/lens-core';

import { ResultRendererGridDirective } from './result-renderer-grid.directive';
import { HttpClientTestingModule } from '@angular/common/http/testing';

const STATIC_CATALOGUE: Array<Category> = [];

describe('ResultRendererGridDirective', () => {
let fixture: ComponentFixture<ResultRendererGridComponent>;
beforeEach(async () => {
let queryTranslatorSpy = jasmine.createSpyObj(['transform']);
let resultTransformerSpy = jasmine.createSpyObj(['transform']);
await TestBed.configureTestingModule({
declarations: [ResultRendererGridDirective, ResultRendererGridComponent],
imports: [HttpClientTestingModule],
providers: [{
provide: QUERY_TRANSLATOR_TOKEN,
useValue: queryTranslatorSpy
},{
provide: RESULT_TRANSFORMER_TOKEN,
useValue: resultTransformerSpy
},{
provide: LENS_CONFIG_TOKEN,
useValue: new LensConfig()
},{
provide: ChipTransformPipe
},{
provide: CATALOGUE_FETCHER_TOKEN,
useClass: TypescriptCatalogueFetcherService
},{
provide: STATIC_CATALOGUE_TOKEN,
useValue: STATIC_CATALOGUE
}]
}).compileComponents();
fixture = TestBed.createComponent(ResultRendererGridComponent);
})
Expand Down

0 comments on commit ceac14d

Please sign in to comment.