Skip to content

Commit 59a2751

Browse files
committed
Refactor unit tests involving Switcher of deep-dives
1 parent 2ef4d71 commit 59a2751

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎src/components/Head/__tests__/Meta.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Meta (Astro)', () => {
1717
pageTitle: 'Example Article',
1818
pageDescription: 'Example description',
1919
path: '/articles/example-article',
20-
canonicalPath: '/deep-dive/example-article',
20+
canonicalPath: '/articles/example-article-canonical',
2121
},
2222
request: new Request('https://example.com/articles/example-article'),
2323
partial: false,
@@ -27,7 +27,7 @@ describe('Meta (Astro)', () => {
2727
const document = new JSDOM(renderedHtml).window.document
2828

2929
expect(document.querySelector('link[rel="canonical"]')?.getAttribute('href')).toBe(
30-
'https://example.com/deep-dive/example-article'
30+
'https://example.com/articles/example-article-canonical'
3131
)
3232
})
3333

‎src/components/Head/server/__tests__/structuredData.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('getSchemas', () => {
3939
const schemas = getSchemas(
4040
createStructuredDataParams({
4141
path: '/articles/example-article',
42-
canonicalPath: '/deep-dive/example-article',
42+
canonicalPath: '/articles/example-article-canonical',
4343
contentType: 'article',
4444
publishDate: new Date('2026-01-01T00:00:00.000Z'),
4545
})
@@ -49,7 +49,7 @@ describe('getSchemas', () => {
4949
const article = parsed.find(schema => schema['@type'] === 'Article')
5050
const breadcrumbs = parsed.find(schema => schema['@type'] === 'BreadcrumbList')
5151

52-
expect(article?.url).toBe('https://www.webstackbuilders.com/deep-dive/example-article')
52+
expect(article?.url).toBe('https://www.webstackbuilders.com/articles/example-article-canonical')
5353
expect(breadcrumbs?.itemListElement?.[1]?.item).toBe(
5454
'https://www.webstackbuilders.com/articles'
5555
)

‎src/components/Search/SearchBar/client/__tests__/index.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe('SearchBar web component', () => {
136136
hits: [
137137
{
138138
title: 'Introduction to Vector Search',
139-
url: 'https://www.webstackbuilders.com/deep-dive/introduction-to-vector-search',
139+
url: 'https://www.webstackbuilders.com/articles/introduction-to-vector-search',
140140
snippet: 'Learn the basics of how vector databases work.',
141141
},
142142
{ title: 'Services', url: '/services' },
@@ -164,15 +164,15 @@ describe('SearchBar web component', () => {
164164
links.some(
165165
link =>
166166
link.getAttribute('href') ===
167-
'https://www.webstackbuilders.com/deep-dive/introduction-to-vector-search'
167+
'https://www.webstackbuilders.com/articles/introduction-to-vector-search'
168168
)
169169
).toBe(true)
170170

171171
const firstLink = links[0]
172172
expect(firstLink?.className).toContain('no-underline')
173173
expect(firstLink?.className).toContain('focus-visible:no-underline')
174174
expect(firstLink?.querySelector('svg')).toBeTruthy()
175-
expect(firstLink?.textContent).toContain('/deep-dive/introduction-to-vector-search')
175+
expect(firstLink?.textContent).toContain('/articles/introduction-to-vector-search')
176176

177177
const firstItem = firstLink?.closest('li')
178178
expect(firstItem?.className).toContain('hover:bg-note-inverse')
@@ -199,7 +199,7 @@ describe('SearchBar web component', () => {
199199
hits: [
200200
{
201201
title: 'Introduction to Vector Search',
202-
url: 'https://www.webstackbuilders.com/deep-dive/introduction-to-vector-search',
202+
url: 'https://www.webstackbuilders.com/articles/introduction-to-vector-search',
203203
snippet: 'Learn the basics of how vector databases work.',
204204
},
205205
],

‎src/components/Search/SearchBar/client/__tests__/results.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ describe('SearchBar result helpers', () => {
1212
})
1313

1414
it('returns the same value for an existing relative url', () => {
15-
expect(getSearchResultDisplayPath('/deep-dive/introduction-to-vector-search')).toBe(
16-
'/deep-dive/introduction-to-vector-search'
15+
expect(getSearchResultDisplayPath('/articles/introduction-to-vector-search')).toBe(
16+
'/articles/introduction-to-vector-search'
1717
)
1818
})
1919

0 commit comments

Comments
 (0)