test('requires non-individual-student overrides to be within specified date range', () => {
      const dueDate = new Date('Nov 30, 2018').toISOString()
      const overrides = [
        { rowKey: '1', course_section_id: '1', due_at: dueDate }
      ]
      const data = { assignment_overrides: overrides }

      const view = new DueDateOverrideView()
      sinon.stub(view, 'postToSIS').returns(false)

      const errors = view.validateDatetimes(data, {})
      strictEqual(errors.due_at.message, 'Due date cannot be after course end')
    })
    test('allows dates for individual students to fall outside of the specified date range', () => {
      const dueDate = new Date('Nov 30, 2018').toISOString()
      const overrides = [
        { rowKey: '1', student_ids: [1], due_at: dueDate }
      ]
      const data = { assignment_overrides: overrides }

      const view = new DueDateOverrideView()
      sinon.stub(view, 'postToSIS').returns(false)

      const errors = view.validateDatetimes(data, {})
      strictEqual(Object.keys(errors).length, 0)
    })
  test('skips overrides whose row key has already been validated', () => {
    const overrides = [
      { rowKey: '1', student_ids: [1] },
      { rowKey: '1', student_ids: [1] }
    ]
    const data = { assignment_overrides: overrides }

    const validateSpy = sinon.spy(DateValidator.prototype, 'validateDatetimes')
    const view = new DueDateOverrideView()
    sinon.stub(view, 'postToSIS').returns(false)

    view.validateDatetimes(data, {})

    strictEqual(validateSpy.callCount, 1)
    validateSpy.restore()
  })