Skip to content

Commit

Permalink
Merge pull request #21 from rrigato/dev
Browse files Browse the repository at this point in the history
S3 web content populated by pipeline
  • Loading branch information
rrigato authored Nov 25, 2023
2 parents 19f05c9 + 1f28b40 commit ad993a0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
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()

});
});

0 comments on commit ad993a0

Please sign in to comment.