-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some safety for missing metadata that was causing build errors (#108
) * Add some safety for missing metadata that was causing build errors; fix #106 * Improve method for adding items to topic summary/landing page * Update yarn.lock * Update tests * Update yarn lock
- Loading branch information
1 parent
b996ef2
commit 6556268
Showing
35 changed files
with
495 additions
and
247 deletions.
There are no files selected for viewing
Binary file removed
BIN
-69.1 KB
.yarn/cache/@eslint-community-regexpp-npm-4.11.0-dd7ae18a6d-f053f371c2.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-16.4 KB
.yarn/cache/@humanwhocodes-config-array-npm-0.11.14-94a02fcc87-3ffb24ecdf.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-25.8 KB
.yarn/cache/electron-to-chromium-npm-1.5.18-367bbd5e5d-7306acc263.zip
Binary file not shown.
Binary file removed
BIN
-25.4 KB
.yarn/cache/eslint-module-utils-npm-2.11.0-43f73367d5-1ba42cf48c.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-241 KB
.yarn/cache/eslint-plugin-react-npm-7.35.2-5f0a9d5db4-f463161244.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-15.2 KB
.yarn/cache/inline-style-parser-npm-0.2.3-b8a7023d7a-10b1808e9c.zip
Binary file not shown.
Binary file removed
BIN
-8.72 KB
.yarn/cache/mdast-util-mdx-expression-npm-2.0.0-442ccac045-378f3cbc89.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-13 KB
.yarn/cache/package-json-from-dist-npm-1.0.0-961f0fcb3b-ac706ec856.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
import '@testing-library/jest-dom'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Page from '../src/app/page'; | ||
import RootLayout from '../src/app/layout'; | ||
import { fetchInterviews } from '../src/data/fetchInterviewData'; | ||
const { getTopicNames } = require('../src/data/helpers/index'); | ||
|
||
describe('Layout component', () => { | ||
beforeEach(() => { | ||
render(<RootLayout />); | ||
}); | ||
describe('getTopicNames', () => { | ||
const legalTopics = [ | ||
{ | ||
name: 'housing', | ||
codes: ['HO-01-00-00-00', 'HO-02-00-00-00'], | ||
}, | ||
{ | ||
name: 'family', | ||
codes: ['FA-00-00-00-00', 'FA-01-00-00-00'], | ||
}, | ||
{ | ||
name: 'employment', | ||
codes: ['EM-01-00-00-00'], | ||
}, | ||
]; | ||
|
||
it('should contain a navigation bar', () => { | ||
const navElement = screen.getByRole('navigation'); | ||
expect(navElement).toBeInTheDocument(); | ||
}); | ||
// Match the import path used in getTopicNames | ||
jest.mock('../src/config/topics.config', () => ({ | ||
legalTopics, | ||
})); | ||
|
||
it('should contain a footer', () => { | ||
const footerElement = screen.getByRole('contentinfo'); | ||
expect(footerElement).toBeInTheDocument(); | ||
it('should return the exact matching topic', () => { | ||
const topicCodes = ['HO-02-00-00-00']; | ||
const result = getTopicNames(topicCodes); | ||
expect(result).toEqual(['housing']); | ||
}); | ||
}); | ||
|
||
// Mock the fetchInterviews function from your data fetching module | ||
jest.mock('../src/data/fetchInterviewData', () => ({ | ||
fetchInterviews: jest.fn(() => | ||
Promise.resolve({ | ||
interviewsByTopic: { | ||
Topic1: [{ id: 1, name: 'Interview 1' }], | ||
Topic2: [{ id: 2, name: 'Interview 2' }], | ||
}, | ||
}) | ||
), | ||
})); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.