         |> Repo.preload(:classes)
       term2_offered_courses = insert_list(4, :offered_course, term: term2)
 
-      expected_offered_courses = preload_associations_for_offered_courses([term1_offered_course | term2_offered_courses])
       summary_data = Summaries.get_term_offered_course_for_user(coordinator)
 
-      assert summary_data == %{terms: [term1, term2], offered_courses: expected_offered_courses}
+      expected_offered_courses =
+        [term1_offered_course | term2_offered_courses]
+        |> preload_associations_for_offered_courses()
+        |> Enum.sort(&(&1.id >= &2.id))
+      expected_terms = Enum.sort([term1, term2], &(&1.id >= &2.id))
+
+      summary_data_returned_terms = Enum.sort(summary_data.terms, &(&1.id >= &2.id))
+      summary_data_returned_offered_courses = Enum.sort(summary_data.offered_courses, &(&1.id >= &2.id))
+
+      assert summary_data_returned_terms == expected_terms
+      assert expected_offered_courses == summary_data_returned_offered_courses
     end
 
     test "when term end time is past all it's data will be excluded" 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: [term1, term2], offered_courses: offered_courses1 ++ offered_courses2}
    end

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

      terms = insert_list(2, :term)
      summary_data = Summaries.get_term_offered_course_for_user(coordinator)

      expected_terms = Enum.sort(terms, &(&1.id >= &2.id))
      summary_data_returned_terms = Enum.sort(summary_data.terms, &(&1.id >= &2.id))

      assert summary_data_returned_terms == expected_terms
      assert summary_data.offered_courses == []
    end

    test "when only one term has offered_course" do
