Skip to content

Is there a test missing in the grade-school exercise? #361

@pedrorolo

Description

@pedrorolo

When implementing this exercise I assumed a student could only belong in a single grade. This requirement makes the exercise interesting because the most convenient storage data structure is not the one that is meant to serve as output, and I wonder to which degree this wasn't the intended challenge underlying this exercise.

I thus propose adding the following test to the exercise:

  it("A student can't be in two different grades", () => {
    gradeSchool.addStudent('Aimee', 2)
    gradeSchool.addStudent('Aimee', 1)

    const emptyGrade = gradeSchool.studentsInGrade(2)
    const expectedDb = new Map(Object.entries({ 2: ['Aimee'] }))
    expect(emptyGrade).toEqual([])
  })

I would like to make a pull-request with this change, but first I wanted to confirm if this implicit requirement makes sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions