 
       summary_data = Summaries.get_term_offered_course_for_user(volunteer)
 
-      assert summary_data == %{terms: [term1, term2], offered_courses: [term2_offered_course]}
+      expected_terms = Enum.sort([term1, term2], &(&1.id >= &2.id))
+      summary_data_terms = Enum.sort(summary_data.terms, &(&1.id >= &2.id))
+
+      assert summary_data_terms == expected_terms
+      assert summary_data.offered_courses == [term2_offered_course]
     end
 
     test "when each term has offered_courses" do

        insert_list(2, :offered_course, term: term2, teachers: [teacher])
        |> Repo.preload(:classes)

      teacher_data = Summaries.get_term_offered_course_for_user(teacher)
      assert teacher_data == %{terms: [term2], offered_courses: offered_courses2}
    end

    test "when she has multiple courses the end_date of all terms are passed" do

        insert_list(2, :offered_course, term: term2, teachers: [teacher])
        |> Repo.preload(:classes)

      expected_offered_courses = Enum.sort(offered_courses1 ++ offered_courses2, &(&1.id >= &2.id))
      expected_terms = Enum.sort([term1, term2], &(&1.id >= &2.id))

      teacher_data = Summaries.get_term_offered_course_for_user(teacher)
      teacher_data_returned_offered_courses = Enum.sort(teacher_data.offered_courses, &(&1.id >= &2.id))
      teacher_data_returned_terms = Enum.sort(teacher_data.terms, &(&1.id >= &2.id))

      assert teacher_data_returned_terms == expected_terms
      assert teacher_data_returned_offered_courses == expected_offered_courses
    end

    test "when she has multiple courses excluding the term that is finished and its data" do
