21a4cea083
- Add Roux.NYTimes module with:
- extractNextData: finds <script id="__NEXT_DATA__"> tag in HTML
and parses its JSON content via aeson
- parseNYTRecipe: maps NYTimes recipe JSON structure into a
typed intermediate representation (NYTRecipe, NYTIngredientGroup,
NYTIngredientItem, NYTStepGroup, NYTStepItem)
- Supports all NYTimes Cooking data: title, URL, total time, yield,
topnote, ingredient groups (with section names), step groups
- Add aeson to dependencies
- Add 4 tests: extraction + parsing for both fried-rice and
carrot-risotto example HTML files
- Wire NYTimesSpec into test runner
19 lines
437 B
Haskell
19 lines
437 B
Haskell
module Main (main) where
|
|
|
|
import Test.Tasty (defaultMain, testGroup)
|
|
import Test.Tasty.Hspec (testSpec)
|
|
|
|
import qualified Roux.NYTimesSpec
|
|
import qualified Roux.ParserSpec
|
|
|
|
main :: IO ()
|
|
main = do
|
|
parserTests <- testSpec "Parser" Roux.ParserSpec.spec
|
|
nytTests <- testSpec "NYTimes" Roux.NYTimesSpec.spec
|
|
defaultMain $
|
|
testGroup
|
|
"roux-server"
|
|
[ parserTests
|
|
, nytTests
|
|
]
|