Skip to content

Commit 1b7571f

Browse files
JeanMechethePunderWoman
authored andcommitted
docs(docs-infra): enable tests for api-gen (angular#57618)
PR Close angular#57618
1 parent 7a4199a commit 1b7571f

File tree

10 files changed

+263
-165
lines changed

10 files changed

+263
-165
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
- name: Build adev in fast mode to ensure it continues to work
8787
run: yarn bazel build //adev:build --config=release
8888
- name: Run tests
89-
run: yarn bazel test //adev:test
89+
run: yarn bazel test //adev/...
9090

9191
publish-snapshots:
9292
runs-on:

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
- name: Build adev in fast mode to ensure it continues to work
116116
run: yarn bazel build //adev:build --config=release
117117
- name: Run tests
118-
run: yarn bazel test //adev:test
118+
run: yarn bazel test //adev/...
119119

120120
zone-js:
121121
runs-on:

adev/shared-docs/components/search-dialog/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ ts_library(
4343
deps = [
4444
":search-dialog",
4545
"//adev/shared-docs/components/algolia-icon",
46+
"//adev/shared-docs/interfaces",
4647
"//adev/shared-docs/providers",
4748
"//adev/shared-docs/services",
4849
"//adev/shared-docs/testing",

adev/shared-docs/components/search-dialog/search-dialog.component.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {AlgoliaIcon} from '../algolia-icon/algolia-icon.component';
1717
import {RouterTestingModule} from '@angular/router/testing';
1818
import {Router} from '@angular/router';
1919
import {provideExperimentalZonelessChangeDetection} from '@angular/core';
20+
import {SearchResult} from '../../interfaces';
2021

2122
describe('SearchDialog', () => {
2223
let fixture: ComponentFixture<SearchDialog>;
@@ -135,6 +136,9 @@ const fakeSearchResults = [
135136
'lvl6': null,
136137
},
137138
'objectID': 'fakeObjectId1',
139+
_snippetResult: {},
140+
type: '',
141+
content: null,
138142
},
139143
{
140144
'url': 'https://angular.dev/fakeUrl2#h1',
@@ -148,5 +152,8 @@ const fakeSearchResults = [
148152
'lvl6': null,
149153
},
150154
'objectID': 'fakeObjectId2',
155+
type: '',
156+
content: null,
157+
_snippetResult: {},
151158
},
152-
];
159+
] satisfies SearchResult[];

adev/shared-docs/components/top-level-banner/top-level-banner.component.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {ComponentFixture, TestBed} from '@angular/core/testing';
22

33
import {STORAGE_KEY_PREFIX, TopLevelBannerComponent} from './top-level-banner.component';
4-
import {LOCAL_STORAGE} from '../../providers';
4+
import {LOCAL_STORAGE, WINDOW} from '../../providers';
55

66
describe('TopLevelBannerComponent', () => {
77
let component: TopLevelBannerComponent;
@@ -15,12 +15,13 @@ describe('TopLevelBannerComponent', () => {
1515
beforeEach(async () => {
1616
mockLocalStorage = jasmine.createSpyObj('Storage', ['getItem', 'setItem']);
1717

18-
await TestBed.configureTestingModule({
19-
imports: [TopLevelBannerComponent],
20-
providers: [{provide: LOCAL_STORAGE, useValue: mockLocalStorage}],
21-
}).compileComponents();
18+
fixture = TestBed.configureTestingModule({
19+
providers: [
20+
{provide: LOCAL_STORAGE, useValue: mockLocalStorage},
21+
{provide: WINDOW, useValue: {location: {origin: ''}}},
22+
],
23+
}).createComponent(TopLevelBannerComponent);
2224

23-
fixture = TestBed.createComponent(TopLevelBannerComponent);
2425
fixture.componentRef.setInput('text', EXAMPLE_TEXT);
2526
fixture.componentRef.setInput('id', EXAMPLE_ID);
2627

@@ -33,7 +34,7 @@ describe('TopLevelBannerComponent', () => {
3334
fixture.componentRef.setInput('link', EXAMPLE_LINK);
3435
fixture.detectChanges();
3536

36-
const bannerElement = fixture.nativeElement.querySelector('a.adev-top-level-banner');
37+
const bannerElement = fixture.nativeElement.querySelector('a.docs-top-level-banner');
3738
expect(bannerElement).toBeTruthy();
3839
expect(bannerElement.getAttribute('href')).toBe(EXAMPLE_LINK);
3940
expect(bannerElement.textContent).toContain(EXAMPLE_TEXT);
@@ -45,7 +46,7 @@ describe('TopLevelBannerComponent', () => {
4546
fixture.componentRef.setInput('text', EXAMPLE_TEXT);
4647
fixture.detectChanges();
4748

48-
const bannerElement = fixture.nativeElement.querySelector('div.adev-top-level-banner');
49+
const bannerElement = fixture.nativeElement.querySelector('div.docs-top-level-banner');
4950
expect(bannerElement).toBeTruthy();
5051
expect(bannerElement.textContent).toContain(EXAMPLE_TEXT);
5152
});
@@ -56,7 +57,7 @@ describe('TopLevelBannerComponent', () => {
5657
fixture.componentRef.setInput('text', EXAMPLE_TEXT);
5758
fixture.detectChanges();
5859

59-
const bannerElement = fixture.nativeElement.querySelector('.adev-top-level-banner-cta');
60+
const bannerElement = fixture.nativeElement.querySelector('.docs-top-level-banner-cta');
6061
expect(bannerElement).toBeTruthy();
6162
expect(bannerElement.textContent).toBe(EXAMPLE_TEXT);
6263
});

0 commit comments

Comments
 (0)