@conorheffron/ironoc-frontend 7.2.1 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/package.json +1 -1
- package/src/App.test.js +44 -0
package/README.md
CHANGED
|
@@ -4,11 +4,27 @@ The ironoc UI built with react for personal portfolio website.
|
|
|
4
4
|
|
|
5
5
|
[](https://github.com/conorheffron/ironoc/actions/workflows/npm-publish-packages.yml)
|
|
6
6
|
|
|
7
|
+
- [GitHub Repository](https://github.com/conorheffron/ironoc)
|
|
8
|
+
- [Frontend Source Code](https://github.com/conorheffron/ironoc/tree/main/frontend)
|
|
7
9
|
- See project README.md [here](https://github.com/conorheffron/ironoc/blob/main/README.md)
|
|
8
10
|
- See npmjs package details here [https://www.npmjs.com/package/@conorheffron/ironoc-frontend](https://www.npmjs.com/package/@conorheffron/ironoc-frontend)
|
|
9
11
|
- See GitHub package details here [https://github.com/conorheffron/ironoc/pkgs/npm/ironoc-frontend](https://github.com/conorheffron/ironoc/pkgs/npm/ironoc-frontend)
|
|
10
12
|
|
|
11
|
-
## Getting Started with React App
|
|
13
|
+
## Getting Started with iRonoc React App
|
|
14
|
+
|
|
15
|
+
#### Quick start
|
|
16
|
+
```shell
|
|
17
|
+
cd frontend
|
|
18
|
+
|
|
19
|
+
npm install
|
|
20
|
+
|
|
21
|
+
npm run build
|
|
22
|
+
|
|
23
|
+
npm run start
|
|
24
|
+
|
|
25
|
+
# press a/enter after the following command to run test suite
|
|
26
|
+
npm run test
|
|
27
|
+
```
|
|
12
28
|
|
|
13
29
|
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
14
30
|
|
package/package.json
CHANGED
package/src/App.test.js
CHANGED
|
@@ -14,6 +14,7 @@ import RepoDetails from './components/RepoDetails';
|
|
|
14
14
|
import RepoIssues from './components/RepoIssues';
|
|
15
15
|
import LoadingSpinner from './LoadingSpinner';
|
|
16
16
|
import AppNavBar from './AppNavbar';
|
|
17
|
+
import Footer from './Footer';
|
|
17
18
|
|
|
18
19
|
// Mocking axios
|
|
19
20
|
jest.mock('axios');
|
|
@@ -379,3 +380,46 @@ describe('Donate Component', () => {
|
|
|
379
380
|
});
|
|
380
381
|
});
|
|
381
382
|
});
|
|
383
|
+
|
|
384
|
+
describe('Footer Component', () => {
|
|
385
|
+
beforeEach(() => {
|
|
386
|
+
// Mock the fetch API
|
|
387
|
+
global.fetch = jest.fn(() =>
|
|
388
|
+
Promise.resolve({
|
|
389
|
+
ok: true,
|
|
390
|
+
text: () => Promise.resolve('2.2.0'),
|
|
391
|
+
})
|
|
392
|
+
);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
afterEach(() => {
|
|
396
|
+
fetch.mockClear();
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
test('renders without crashing', () => {
|
|
400
|
+
render(<Footer />);
|
|
401
|
+
expect(screen.getByText(/© 2025 by Conor Heffron/)).toBeInTheDocument();
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
test('initial state is set correctly', () => {
|
|
405
|
+
const { container } = render(<Footer />);
|
|
406
|
+
const footerText = container.querySelector('.ft');
|
|
407
|
+
expect(footerText).toHaveTextContent('© 2025 by Conor Heffron |');
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
test('fetches and displays the version', async () => {
|
|
411
|
+
render(<Footer />);
|
|
412
|
+
await waitFor(() => expect(fetch).toHaveBeenCalledTimes(1));
|
|
413
|
+
await waitFor(() => expect(screen.getByText('© 2025 by Conor Heffron | 2.2.0')).toBeInTheDocument());
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test('handles fetch error', async () => {
|
|
417
|
+
fetch.mockImplementationOnce(() =>
|
|
418
|
+
Promise.reject(new Error('Network response was not ok'))
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
render(<Footer />);
|
|
422
|
+
await waitFor(() => expect(fetch).toHaveBeenCalledTimes(1));
|
|
423
|
+
await waitFor(() => expect(screen.getByText('© 2025 by Conor Heffron |')).toBeInTheDocument());
|
|
424
|
+
});
|
|
425
|
+
});
|