Skip to content

Additional Test Cases for GradeSchool given a same student add twice to different grade #1337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andsus opened this issue Sep 11, 2021 · 4 comments

Comments

@andsus
Copy link

andsus commented Sep 11, 2021

Currently the test case does not test the above scenario.

  • Given student A add to specific grade. E.g., Student A add to grade 2. And student B add to grade2
  • When student A is add again into different grade E.g., Student A add to grade 3
  • Expected to see roster where Student A is in grade 3, and Student B in grade 2.

The GradeSchool exercise exists in many other track language, and this this use case is not tested across other tracks.

Suggested to add more test case as follow:

// adding more test case
  it ('adding more students to the same grade and move same student to different grade for promotions', () => {
    gradeSchool.addStudent('Paul', 2)
    gradeSchool.addStudent('Blair', 2)
    gradeSchool.addStudent('James', 2)
    gradeSchool.addStudent('Paul', 3)

    const expectedDb = new Map(
      Object.entries({ 2: ['Blair', 'James'], 3: ['Paul'] })
    )
    expect(gradeSchool.studentRoster()).toEqual(expectedDb)
  })

Let me know how to get started on reviewing this issue?

@junedev
Copy link
Member

junedev commented Sep 11, 2021

Are you maybe looking at an older version of the tests? When I look at the current version I already see a test case for adding the same student twice in different grades:

xtest("a student can't be in two different grades", () => {
school.add('Aimee', 2);
school.add('Aimee', 1);
expect(school.grade(2)).toEqual([]);
});

@andsus
Copy link
Author

andsus commented Sep 13, 2021

  • What happen with Blair and James, when Paul move to grade 3?
    ** Expect, Blair and James should still be in grade 2

I've seen solution that wipe the entire grade 2, when Paul move from grade 2 to 3.

That case is not covered in the current test case.

@junedev
Copy link
Member

junedev commented Sep 14, 2021

@andsus Ah ok, I got the point now.

The list of test cases for this exercise originate in another repository: https://github.com/exercism/problem-specifications

While it is possible to add an extra test just for JavaScript, it is best to fix the shared content so all tracks benefit. Currently someone is in the process of fixing the grade school test cases, exercism/problem-specifications#1837. I left them a note regarding your input.

@junedev
Copy link
Member

junedev commented Sep 21, 2021

Closing this as the person working on the grade school fixes confirmed they will incorporate your feedback.

@junedev junedev closed this as completed Sep 21, 2021
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

No branches or pull requests

2 participants