csc302-spring-2021/proj-DaTeam

Implement all sub parsers of SDCParser (master issue)

Closed this issue · 0 comments

otomn commented

Description

This is the master issue for implementing SDCParser
The development of this feature will be test driven. All developers should write the tests first.
FormParser is pretty much done, use that as an example

Testing

Source XML for test are located at backend/__tests__/SDCTestData.ts
Test script is located at backend/__tests__/SDCParser.spec.ts

Testing command:

cd backend
tsc
npx jest __tests__/SDCParser.spec.ts # or
npx jest __tests__/SDCParser.spec.ts -t "Parse Form" # to run a specific test

Sub parsers and features

NodeParser

  • Parses attributes on SDCNode (done)
  • create and call the other parsers recursively on children (todo)

FormParser

  • Parse SDCForm
  • Call FormPropertyParser to parse the properties (todo)

QuestionParser

  • Create and Call either TextFieldParser or ListFieldParser

DisplayedItemParser

  • Parse SDCDisplayItem

SectionParser

  • Parse SDCSection

TextFieldParser

  • SDCTextField

ListFieldParser

  • SDCListField
  • Call ListFieldItemParser to parse the options

ListFieldItemParser

  • Parse SDCListFieldItem
  • Call TextFieldParser on the text field if applicable