Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 web content populated by pipeline #21

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/scripts/homepage_source_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@

set -e

cd dist

ls

aws s3 cp --dryrun . s3://$AWS_S3_BUCKET_NAME \
--recursive
aws s3 cp --recursive ./dist s3://ryanrigato.com
1 change: 0 additions & 1 deletion .github/workflows/homepage_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
16 changes: 8 additions & 8 deletions static/js/HomePageToggle.jsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -82,14 +83,13 @@ export function HomePageToggle(){
<div hidden={true}></div>
}
</div>
<div
id='toggle-2'

hidden= {
selectedSection !== 2
}>
Latest Books
<div>
{
selectedSection === 2 ? <BookRecommendations/> :
<div hidden={true}></div>
}
</div>

</div>
</div>
);
Expand Down
22 changes: 22 additions & 0 deletions static/tests/HomePageToggle.test.js
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -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(<div>mock-projects-component</div>);
About.mockReturnValue(<div>mock-about-component</div>);
BookRecommendations.mockReturnValue(
<div>mock-book-recommendations-component</div>
);


const {findByRole} = render(<HomePageToggle/>);


const bookRecommendationsButton = await findByRole(
'button', {name: 'Book Recommendations'}
);
await userStep.click(bookRecommendationsButton);
expect(BookRecommendations).toHaveBeenCalled()

});
});