Skip to content

Commit

Permalink
some qol fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-pulley committed Jun 28, 2023
1 parent 7f3c742 commit 0aff7f6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ COPY --from=go-build /app/shakesearch ./shakesearch
COPY --from=go-build /app/static ./static
COPY --from=go-build /app/completeworks.txt ./completeworks.txt

EXPOSE 3001
ENV PORT=3002

CMD ["sh", "-c", "./shakesearch & sleep 1 && npx mocha test.js"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ go-test:

frontend-test:
docker build -t shakesearch-test -f Dockerfile.test .
docker run --rm -p 3001:3001 shakesearch-test
docker run --rm shakesearch-test
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Welcome to the Pulley Shakesearch Challenge! This repository contains a simple w

## Prerequisites

To run the tests, you need to have Go and Docker installed on your system.
To run the tests, you need to have [Go](https://go.dev/doc/install) and [Docker](https://docs.docker.com/engine/install/) installed on your system.

## Your Task

Expand All @@ -15,16 +15,26 @@ Your task is to fix the underlying code to make the failing tests in the app pas
1. Fork this repository.
2. Fix the underlying code to make the tests pass.
3. Open a pull request, which will run the tests through GitHub Actions. Ensure all tests pass.
4. Email us back with a short explanation of the process of making the tests pass by improving the code.
4. Include a short explanation of your changes in the pull request.
5. Email us back with a link to the pull request.

## Running the App Locally


This command runs the app on your machine and will be available in browser at localhost:3001.

```bash
make run
```

## Running the Tests

This command runs backend and frontend tests.

Backend testing directly runs all Go tests.

Frontend testing run the app and mochajs tests inside docker, using internal port 3002.

```bash
make test
```
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
port = "3001"
}

fmt.Printf("Listening on port %s...", port)
fmt.Printf("shakesearch available at http://localhost:%s...", port)
err = http.ListenAndServe(fmt.Sprintf(":%s", port), nil)
if err != nil {
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('ShakeSearch', () => {
args: ['--no-sandbox'],
});
page = await browser.newPage();
await page.goto('http://localhost:3001');
await page.goto('http://localhost:3002');
});

after(async () => {
Expand Down

0 comments on commit 0aff7f6

Please sign in to comment.