diff --git a/README.md b/README.md index aeb8994d6..44d11c702 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,26 @@ make test ``` Good luck! + + +## Description + +I worked majorly on 2 files, namely: +```bash +- main.go +- index.html +``` +In order to fix the code breaking **TestSearchCaseSensitive** test case, what I did was to have 2 copies of the data read from `completeworks.txt`. + +I made one of the copy letters all small case and then ran the sort Array index algorithm on this data. +I also made sure that the data passed as a query was converted in to small case, hence making the search for indices case insensitive. +When I was to return a portion of the text back to the user, I made use of the first copy of data i.e the unaltered version of `completworks.txt` data. +In order to fix the code breaking **TestSearchDrunk** test case, what I did was to make use of a function called FindAllIndex found in the suffix array package. +The function makes it possible for you to find indices of substrings that match a given regular expression. + +So I went ahead to convert the query been passed into a ‘exact match’ regular expression, the regular expression generated is then passed to the FindAllIndex to get indices of all substrings with the exact match. +The two indices returned represents the start index and end index of the substring. I use these values to return a section of the article for the user. +Since the testCase was expecting only 20 items and there was the possibility of the substrings occurring more than 20 times, I limited the amount of indices returned to 20 by passing 20 as the second argument to FindAllIndex function. + +In order to fix the code breaking `should load more results for “horse” when clicking “Load More”` test case, what I did was to give the load more button an id of `load-more`. +Since puppetter function `page.click(‘#load-more’)` was looking for a clickable item with an id of `load-more`. \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 000000000..a5ec37ca3 --- /dev/null +++ b/index.html @@ -0,0 +1,28 @@ + + + +
+ ++
+ ++