From b246eb816349c8c96928038fb5719611ae3e4c82 Mon Sep 17 00:00:00 2001 From: rrigato Date: Sat, 25 Nov 2023 09:39:11 -0600 Subject: [PATCH 1/3] BookRecommendations called from homepage toggle --- static/js/HomePageToggle.jsx | 16 ++++++++-------- static/tests/HomePageToggle.test.js | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/static/js/HomePageToggle.jsx b/static/js/HomePageToggle.jsx index ce94a83..f5b7ce2 100644 --- a/static/js/HomePageToggle.jsx +++ b/static/js/HomePageToggle.jsx @@ -1,7 +1,8 @@ import React, { useState } from 'react'; import '../css/main.css'; -import { Projects } from './Projects.jsx'; import { About } from './About.jsx'; +import { BookRecommendations } from './BookRecommendations.jsx'; +import { Projects } from './Projects.jsx'; /**Toggle button for different sections of homepage @@ -82,14 +83,13 @@ export function HomePageToggle(){ } - ); diff --git a/static/tests/HomePageToggle.test.js b/static/tests/HomePageToggle.test.js index 08dbb36..91db13d 100644 --- a/static/tests/HomePageToggle.test.js +++ b/static/tests/HomePageToggle.test.js @@ -1,10 +1,12 @@ import { render } from '@testing-library/react'; import { userEvent } from '@testing-library/user-event'; import { About } from '../js/About.jsx'; +import { BookRecommendations } from '../js/BookRecommendations.jsx'; import { HomePageToggle } from '../js/HomePageToggle.jsx'; import { Projects } from '../js/Projects.jsx'; jest.mock('../js/About.jsx'); +jest.mock('../js/BookRecommendations.jsx'); jest.mock('../js/Projects.jsx'); describe('Central Content for site', () => { @@ -49,4 +51,24 @@ describe('Central Content for site', () => { expect(About).toHaveBeenCalled() }); + + test('BookRecommendations component called when clicked', async () => { + const userStep = userEvent.setup(); + Projects.mockReturnValue(
mock-projects-component
); + About.mockReturnValue(
mock-about-component
); + BookRecommendations.mockReturnValue( +
mock-book-recommendations-component
+ ); + + + const {findByRole} = render(); + + + const bookRecommendationsButton = await findByRole( + 'button', {name: 'Book Recommendations'} + ); + await userStep.click(bookRecommendationsButton); + expect(BookRecommendations).toHaveBeenCalled() + + }); }); \ No newline at end of file From 72ba3557aa2dc5f49a317b0d86fb21d653792fd4 Mon Sep 17 00:00:00 2001 From: rrigato Date: Sat, 25 Nov 2023 09:43:15 -0600 Subject: [PATCH 2/3] cleanup pipeline --- .github/scripts/homepage_source_files.sh | 7 +------ .github/workflows/homepage_update.yml | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/scripts/homepage_source_files.sh b/.github/scripts/homepage_source_files.sh index c51659f..87d1658 100644 --- a/.github/scripts/homepage_source_files.sh +++ b/.github/scripts/homepage_source_files.sh @@ -2,9 +2,4 @@ set -e -cd dist - -ls - -aws s3 cp --dryrun . s3://$AWS_S3_BUCKET_NAME \ ---recursive +aws s3 cp --recursive . s3://ryanrigato.com diff --git a/.github/workflows/homepage_update.yml b/.github/workflows/homepage_update.yml index 76d8935..67165d2 100644 --- a/.github/workflows/homepage_update.yml +++ b/.github/workflows/homepage_update.yml @@ -34,7 +34,6 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{secrets.PERSISTANT_STORAGE_ID}} AWS_DEFAULT_REGION: 'us-east-1' - AWS_S3_BUCKET_NAME: 'ryanrigato.com' AWS_SECRET_ACCESS_KEY: ${{secrets.PERSISTANT_STORAGE_KEY}} run: '../.github/scripts/homepage_source_files.sh' From 1f28b40b67d9f34b98dc17743f576540e5f4fc95 Mon Sep 17 00:00:00 2001 From: rrigato Date: Sat, 25 Nov 2023 09:54:55 -0600 Subject: [PATCH 3/3] correct bundle folder --- .github/scripts/homepage_source_files.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/homepage_source_files.sh b/.github/scripts/homepage_source_files.sh index 87d1658..1176411 100644 --- a/.github/scripts/homepage_source_files.sh +++ b/.github/scripts/homepage_source_files.sh @@ -2,4 +2,4 @@ set -e -aws s3 cp --recursive . s3://ryanrigato.com +aws s3 cp --recursive ./dist s3://ryanrigato.com