Skip to content

Conversation

@SoggyRhino
Copy link
Contributor

Test data is stored in parser/testdata. The idea is that there each parser will using the input.html and compare to proffessor.json/course.json, etc. I only have 5 test but I've only really worked on parseSection.

testdata
    ├───case_001
    │       course.json
    │       input.html
    │       section.json
    │
    ├───case_002
    │       course.json
    │       input.html
    │       section.json
    │

test_helpers_test.go

  • simple loader for the test data
type TestData struct {
	RowInfo   map[string]*goquery.Selection
	ClassInfo map[string]string
	Section   schema.Section
	Course    schema.Course
}

parser.go

  • moved all the parsing into sectionParser
  • moved rowInfo and classInfo into functions so that it was easier to test other functions that needed them as input

sectionParser.go

  • Since parseSection() didn't return anything I just made functions for all of the fields and tested them individually

courseParser.go

  • Since all of the fields of each course are basically just classInfo["key"], so I didn't make individual functions
  • getSection() now handles the parsing
  • parseSection() is more like get or load

@jpahm
Copy link
Contributor

jpahm commented Feb 27, 2025

Completes #43. Will review soon.

@jpahm jpahm merged commit 1f80db5 into UTDNebula:develop Mar 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants