code-challenge icon indicating copy to clipboard operation
code-challenge copied to clipboard

Grossberg code challenge

Open dwgrossberg opened this issue 1 year ago • 0 comments

Overview

This PR is a solution to the code-challenge problem of recreating the address parsing form in DataMade's Parserator web service.

Demo

data-made-code-challenge

Notes

A slight addition to the Dockerfile was required in order for me to successfully build the application. I needed to install npm using the script: RUN apt-get update && apt-get install -y npm.

Additionally, I encountered a few linting errors while making use of ES6 syntax, however as far as I can tell this did not impact the application's performance.

Testing Instructions

  • Run docker-compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app to test the application
  • test_api_address_resolves_to_view_name ensures that the api endpoint address matches the api view name as expected.
  • test_api_parse_succeeds tests that a valid address string will be correctly parsed by the application. This test checks that the data returned will be in the correct form and that the status_code will be 200.
  • test_api_parse_raises_error tests that an invalid address string will correctly raise a RepeatedLabelError. This test checks that the data returned will contain the correct error information and that the status_code will be 400.
  • test_missing_address_query_term_raises_parse_error checks that a corrupted query_param will result in a ParseError.
  • test_api_parse_empty_string_succeeds verifies that a blank string will return a response status_code of 200.

dwgrossberg avatar Jul 15 '24 16:07 dwgrossberg