fixing tests that require specific year called out

flag=none
refs NONE

TEST PLAN:
  ensure build completes and all tests run successfully

Change-Id: I3f291c4f52f527e1e4917e5304581bec84cc4018
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/281998
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Bobby Buten <bobby.buten@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Bobby Buten <bobby.buten@instructure.com>
Product-Review: Bobby Buten <bobby.buten@instructure.com>
This commit is contained in:
Bobby Buten 2022-01-03 11:13:19 -05:00
parent 7cc2c0c7f1
commit d9f491fc00
15 changed files with 118 additions and 130 deletions

View File

@ -154,51 +154,51 @@ QUnit.module('CreateAssignmentView', {
}
})
test('should be accessible', function(assert) {
test('should be accessible', function (assert) {
const view = createView(this.assignment1)
const done = assert.async()
assertions.isAccessible(view, done, {a11yReport: true})
})
test('initialize generates a new assignment for creation', function() {
test('initialize generates a new assignment for creation', function () {
const view = createView(this.group)
equal(view.model.get('assignment_group_id'), this.group.get('id'))
})
test('initialize uses existing assignment for editing', function() {
test('initialize uses existing assignment for editing', function () {
const view = createView(this.assignment1)
equal(view.model.get('name'), this.assignment1.get('name'))
})
test('render shows multipleDueDates if we have all dates', function() {
test('render shows multipleDueDates if we have all dates', function () {
const view = createView(this.assignment1)
equal(view.$('.multiple_due_dates').length, 1)
})
test('render shows date picker when there are not multipleDueDates', function() {
test('render shows date picker when there are not multipleDueDates', function () {
const view = createView(this.assignment2)
equal(view.$('.multiple_due_dates').length, 0)
})
test('render shows canChooseType for creation', function() {
test('render shows canChooseType for creation', function () {
const view = createView(this.group)
equal(view.$('#ag_1_assignment_type').length, 1)
equal(view.$('#assign_1_assignment_type').length, 0)
})
test('render hides canChooseType for editing', function() {
test('render hides canChooseType for editing', function () {
const view = createView(this.assignment1)
equal(view.$('#ag_1_assignment_type').length, 0)
equal(view.$('#assign_1_assignment_type').length, 0)
})
test('render hides date picker and points_possible for pages', function() {
test('render hides date picker and points_possible for pages', function () {
const view = createView(this.assignment5)
equal(view.$('.date_field_container').length, 0)
equal(view.$('input[name=points_possible]').length, 0)
})
test('onSaveSuccess adds model to assignment group for creation', function() {
test('onSaveSuccess adds model to assignment group for creation', function () {
sandbox.stub(DialogFormView.prototype, 'close')
equal(this.group.get('assignments').length, 2)
const view = createView(this.group)
@ -206,7 +206,7 @@ test('onSaveSuccess adds model to assignment group for creation', function() {
equal(this.group.get('assignments').length, 3)
})
test('the form is cleared after adding an assignment', function() {
test('the form is cleared after adding an assignment', function () {
sandbox.stub(DialogFormView.prototype, 'close')
const view = createView(this.group)
view.onSaveSuccess()
@ -214,7 +214,7 @@ test('the form is cleared after adding an assignment', function() {
equal(view.$(`#ag_${this.group.id}_assignment_points`).val(), '0')
})
test('moreOptions redirects to new page for creation', function() {
test('moreOptions redirects to new page for creation', function () {
sandbox.stub(CreateAssignmentView.prototype, 'newAssignmentUrl')
sandbox.stub(CreateAssignmentView.prototype, 'redirectTo')
const view = createView(this.group)
@ -222,14 +222,14 @@ test('moreOptions redirects to new page for creation', function() {
ok(view.redirectTo.called)
})
test('moreOptions redirects to edit page for editing', function() {
test('moreOptions redirects to edit page for editing', function () {
sandbox.stub(CreateAssignmentView.prototype, 'redirectTo')
const view = createView(this.assignment1)
view.moreOptions()
ok(view.redirectTo.called)
})
test('moreOptions creates a quiz if submission_types is online_quiz', function() {
test('moreOptions creates a quiz if submission_types is online_quiz', function () {
const newQuizUrl = 'http://example.com/course/1/quizzes/new'
const formData = {submission_types: 'online_quiz'}
sandbox.stub(CreateAssignmentView.prototype, 'getFormData').returns(formData)
@ -243,66 +243,66 @@ test('moreOptions creates a quiz if submission_types is online_quiz', function()
ok(view.redirectTo.calledWith(quizEditUrl))
})
test('generateNewAssignment builds new assignment model', function() {
test('generateNewAssignment builds new assignment model', function () {
const view = createView(this.group)
const assign = view.generateNewAssignment()
ok(assign.constructor === Assignment)
})
test('toJSON creates unique label for creation', function() {
test('toJSON creates unique label for creation', function () {
const view = createView(this.group)
const json = view.toJSON()
equal(json.uniqLabel, 'ag_1')
})
test('toJSON creates unique label for editing', function() {
test('toJSON creates unique label for editing', function () {
const view = createView(this.assignment1)
const json = view.toJSON()
equal(json.uniqLabel, 'assign_1')
})
test('toJSON includes can choose type when creating', function() {
test('toJSON includes can choose type when creating', function () {
const view = createView(this.group)
const json = view.toJSON()
ok(json.canChooseType)
})
test('toJSON includes cannot choose type when creating', function() {
test('toJSON includes cannot choose type when creating', function () {
const view = createView(this.assignment1)
const json = view.toJSON()
ok(!json.canChooseType)
})
test('toJSON includes key for disableDueAt', function() {
test('toJSON includes key for disableDueAt', function () {
const view = createView(this.assignment1)
ok('disableDueAt' in view.toJSON())
})
test('toJSON includes key for isInClosedPeriod', function() {
test('toJSON includes key for isInClosedPeriod', function () {
const view = createView(this.assignment1)
ok('isInClosedPeriod' in view.toJSON())
})
test('disableDueAt returns true if due_at is a frozen attribute', function() {
test('disableDueAt returns true if due_at is a frozen attribute', function () {
const view = createView(this.assignment1)
sandbox.stub(view.model, 'frozenAttributes').returns(['due_at'])
equal(view.disableDueAt(), true)
})
test('disableDueAt returns false if the user is an admin', function() {
test('disableDueAt returns false if the user is an admin', function () {
const view = createView(this.assignment1)
sandbox.stub(view, 'currentUserIsAdmin').returns(true)
equal(view.disableDueAt(), false)
})
test('disableDueAt returns true if the user is not an admin and the assignment has a due date in a closed grading period', function() {
test('disableDueAt returns true if the user is not an admin and the assignment has a due date in a closed grading period', function () {
const view = createView(this.assignment1)
sandbox.stub(view, 'currentUserIsAdmin').returns(false)
sandbox.stub(view.model, 'inClosedGradingPeriod').returns(true)
equal(view.disableDueAt(), true)
})
test("openAgain doesn't add datetime for multiple dates", function() {
test("openAgain doesn't add datetime for multiple dates", function () {
sandbox.stub(DialogFormView.prototype, 'openAgain')
sandbox.spy($.fn, 'datetime_field')
const view = createView(this.assignment1)
@ -310,7 +310,7 @@ test("openAgain doesn't add datetime for multiple dates", function() {
ok($.fn.datetime_field.notCalled)
})
test('openAgain adds datetime picker', function() {
test('openAgain adds datetime picker', function () {
sandbox.stub(DialogFormView.prototype, 'openAgain')
sandbox.spy($.fn, 'datetime_field')
I18nStubber.setLocale('fr_FR')
@ -324,37 +324,31 @@ test('openAgain adds datetime picker', function() {
ok($.fn.datetime_field.called)
})
test('adjust datetime to the end of a day for midnight time', function() {
test('adjust datetime to the end of a day for midnight time', function () {
sandbox.stub(DialogFormView.prototype, 'openAgain')
I18nStubber.useInitialTranslations()
const tmp = $.screenReaderFlashMessageExclusive
$.screenReaderFlashMessageExclusive = sinon.spy()
const view = createView(this.assignment2)
view.openAgain()
view.$el
.find('.datetime_field')
.val('Feb 2, 2021')
.trigger('change')
equal(view.$el.find('.datetime_field').val(), 'Feb 2 11:59pm')
view.$el.find('.datetime_field').val('Feb 2, 2021').trigger('change')
equal(view.$el.find('.datetime_field').val(), 'Feb 2, 2021 11:59pm')
$.screenReaderFlashMessageExclusive = tmp
})
test('it does not adjust datetime for other date time', function() {
test('it does not adjust datetime for other date time', function () {
sandbox.stub(DialogFormView.prototype, 'openAgain')
I18nStubber.useInitialTranslations()
const tmp = $.screenReaderFlashMessageExclusive
$.screenReaderFlashMessageExclusive = sinon.spy()
const view = createView(this.assignment2)
view.openAgain()
view.$el
.find('#assign_3_assignment_due_at')
.val('Feb 2, 2021, 1:27pm')
.trigger('change')
equal(view.$el.find('#assign_3_assignment_due_at').val(), 'Feb 2 1:27pm')
view.$el.find('#assign_3_assignment_due_at').val('Feb 2, 2021, 1:27pm').trigger('change')
equal(view.$el.find('#assign_3_assignment_due_at').val(), 'Feb 2, 2021 1:27pm')
$.screenReaderFlashMessageExclusive = tmp
})
test("openAgain doesn't add datetime picker if disableDueAt is true", function() {
test("openAgain doesn't add datetime picker if disableDueAt is true", function () {
sandbox.stub(DialogFormView.prototype, 'openAgain')
sandbox.spy($.fn, 'datetime_field')
const view = createView(this.assignment2)
@ -363,7 +357,7 @@ test("openAgain doesn't add datetime picker if disableDueAt is true", function()
ok($.fn.datetime_field.notCalled)
})
test('requires name to save assignment', function() {
test('requires name to save assignment', function () {
const view = createView(this.assignment3)
const data = {name: ''}
const errors = view.validateBeforeSave(data, [])
@ -372,7 +366,7 @@ test('requires name to save assignment', function() {
equal(errors.name[0].message, 'Name is required!')
})
test('requires due_at to be in an open grading period if it is being changed and the user is a teacher', function() {
test('requires due_at to be in an open grading period if it is being changed and the user is a teacher', function () {
ENV.HAS_GRADING_PERIODS = true
ENV.active_grading_periods = [
{
@ -395,7 +389,7 @@ test('requires due_at to be in an open grading period if it is being changed and
equal(errors.due_at[0].message, 'Due date cannot fall in a closed grading period')
})
test('does not require due_at to be in an open grading period if it is being changed and the user is an admin', function() {
test('does not require due_at to be in an open grading period if it is being changed and the user is an admin', function () {
ENV.active_grading_periods = [
{
id: '1',
@ -417,7 +411,7 @@ test('does not require due_at to be in an open grading period if it is being cha
notOk(errors.due_at)
})
test('requires name to save assignment', function() {
test('requires name to save assignment', function () {
const view = createView(this.assignment3)
const data = {name: ''}
const errors = view.validateBeforeSave(data, [])
@ -426,7 +420,7 @@ test('requires name to save assignment', function() {
equal(errors.name[0].message, 'Name is required!')
})
test('has an error when a name has 257 chars', function() {
test('has an error when a name has 257 chars', function () {
const view = createView(this.assignment3)
const errors = nameLengthHelper(view, 257, false, 30, '1')
ok(errors.name)
@ -434,20 +428,20 @@ test('has an error when a name has 257 chars', function() {
equal(errors.name[0].message, 'Name is too long, must be under 257 characters')
})
test('allows assignment to save when a name has 256 chars, MAX_NAME_LENGTH is not required and post_to_sis is true', function() {
test('allows assignment to save when a name has 256 chars, MAX_NAME_LENGTH is not required and post_to_sis is true', function () {
const view = createView(this.assignment3)
const errors = nameLengthHelper(view, 256, false, 30, '1')
equal(errors.length, 0)
})
test('allows assignment to save when a name has 15 chars, MAX_NAME_LENGTH is 10 and is required, post_to_sis is true and grading_type is not_graded', function() {
test('allows assignment to save when a name has 15 chars, MAX_NAME_LENGTH is 10 and is required, post_to_sis is true and grading_type is not_graded', function () {
this.assignment3.grading_type = 'not_graded'
const view = createView(this.assignment3)
const errors = nameLengthHelper(view, 15, true, 10, '1')
equal(errors.length, 0)
})
test('has an error when a name has 11 chars, MAX_NAME_LENGTH is 10 and is required, and post_to_sis is true', function() {
test('has an error when a name has 11 chars, MAX_NAME_LENGTH is 10 and is required, and post_to_sis is true', function () {
const view = createView(this.assignment3)
const errors = nameLengthHelper(view, 11, true, 10, '1')
ok(errors.name)
@ -458,26 +452,26 @@ test('has an error when a name has 11 chars, MAX_NAME_LENGTH is 10 and is requir
)
})
test('allows assignment to save when name has 11 chars, MAX_NAME_LENGTH is 10 and required, but post_to_sis is false', function() {
test('allows assignment to save when name has 11 chars, MAX_NAME_LENGTH is 10 and required, but post_to_sis is false', function () {
const view = createView(this.assignment3)
const errors = nameLengthHelper(view, 11, true, 10, '0')
equal(errors.length, 0)
})
test('allows assignment to save when name has 10 chars, MAX_NAME_LENGTH is 10 and required, and post_to_sis is true', function() {
test('allows assignment to save when name has 10 chars, MAX_NAME_LENGTH is 10 and required, and post_to_sis is true', function () {
const view = createView(this.assignment3)
const errors = nameLengthHelper(view, 10, true, 10, '1')
equal(errors.length, 0)
})
test("don't validate name if it is frozen", function() {
test("don't validate name if it is frozen", function () {
const view = createView(this.assignment3)
this.assignment3.set('frozen_attributes', ['title'])
const errors = view.validateBeforeSave({}, [])
ok(!errors.name)
})
test('rejects a letter for points_possible', function() {
test('rejects a letter for points_possible', function () {
const view = createView(this.assignment3)
const data = {
name: 'foo',
@ -488,13 +482,13 @@ test('rejects a letter for points_possible', function() {
equal(errors.points_possible[0].message, 'Points possible must be a number')
})
test('passes explicit submission_type for Assignment option', function() {
test('passes explicit submission_type for Assignment option', function () {
const view = createView(this.group)
const data = view.getFormData()
equal(data.submission_types, 'none')
})
test('validates due date against date range', function() {
test('validates due date against date range', function () {
const start_at = {
date: new Date('August 20, 2013').toISOString(),
date_context: 'term'
@ -525,7 +519,7 @@ test('validates due date against date range', function() {
equal(end_at, ENV.VALID_DATE_RANGE.end_at)
})
test('validates due date for lock and unlock', function() {
test('validates due date for lock and unlock', function () {
const view = createView(this.assignment4)
let data = {
name: 'Example',
@ -543,7 +537,7 @@ test('validates due date for lock and unlock', function() {
equal(errors.due_at[0].message, 'Due date cannot be before unlock date')
})
test('renders due dates with locale-appropriate format string', function() {
test('renders due dates with locale-appropriate format string', function () {
tzInTest.configureAndRestoreLater({
tz: timezone(french, 'fr_FR'),
momentLocale: 'fr'
@ -554,17 +548,10 @@ test('renders due dates with locale-appropriate format string', function() {
'date.abbr_month_names.8': 'août'
})
const view = createView(this.assignment1)
equal(
view
.$('#vdd_tooltip_assign_1 div dd')
.first()
.text()
.trim(),
'28 août'
)
equal(view.$('#vdd_tooltip_assign_1 div dd').first().text().trim(), '28 août')
})
test('renders due dates in appropriate time zone', function() {
test('renders due dates in appropriate time zone', function () {
tzInTest.configureAndRestoreLater({
tz: timezone(juneau, 'America/Juneau'),
tzData: {
@ -577,14 +564,7 @@ test('renders due dates in appropriate time zone', function() {
'date.abbr_month_names.8': 'Aug'
})
const view = createView(this.assignment1)
equal(
view
.$('#vdd_tooltip_assign_1 div dd')
.first()
.text()
.trim(),
'Aug 27'
)
equal(view.$('#vdd_tooltip_assign_1 div dd').first().text().trim(), 'Aug 27')
})
QUnit.module('due_at', hooks => {

View File

@ -296,7 +296,7 @@ describe GradebooksHelper do
title: "My Due Date Assignment",
due_at: "2021-04-15T22:00:24Z"
)
expect(translated_due_date_for_speedgrader(assignment)).to eq "Due: Apr 15 at 10pm"
expect(translated_due_date_for_speedgrader(assignment)).to eq "Due: Apr 15, 2021 at 10pm"
end
it "produces No due date message if no due date" do
@ -322,7 +322,7 @@ describe GradebooksHelper do
workflow_state: "active"
)
assignment.reload
expect(translated_due_date_for_speedgrader(assignment)).to eq "Due: Apr 15 at 10pm"
expect(translated_due_date_for_speedgrader(assignment)).to eq "Due: Apr 15, 2021 at 10pm"
end
end
end

View File

@ -306,7 +306,7 @@ describe('DiscussionFullPage', () => {
it('renders the dates properly', async () => {
const container = setup(getDiscussionQueryMock())
expect(await container.findByText('Nov 23, 2020 6:40pm')).toBeInTheDocument()
expect(await container.findByText('Last reply Apr 5 7:41pm')).toBeInTheDocument()
expect(await container.findByText('Last reply Apr 5, 2021 7:41pm')).toBeInTheDocument()
})
})

View File

@ -84,8 +84,8 @@ describe('AssignmentAvailabilityContainer', () => {
assignmentOverrides: {nodes: []}
})
expect(queryByText('Everyone')).toBeTruthy()
expect(queryByText('Due Mar 31 5:59am')).toBeTruthy()
expect(queryByText('Available from Mar 24 until Apr 4')).toBeTruthy()
expect(queryByText('Due Mar 31, 2021 5:59am')).toBeTruthy()
expect(queryByText('Available from Mar 24, 2021 until Apr 4, 2021')).toBeTruthy()
})
it('displays "Show due dates" button when there are overrides', () => {
@ -102,7 +102,7 @@ describe('AssignmentAvailabilityContainer', () => {
expect(queryByText('Show Due Dates (4)')).toBeTruthy()
fireEvent.click(queryByText('Show Due Dates (4)'))
expect(await findByTestId('due-dates-tray-heading')).toBeTruthy()
expect(await findByText('Sep 4 5:59am')).toBeTruthy()
expect(await findByText('Sep 4, 2021 5:59am')).toBeTruthy()
})
it('correct text is shown when a date is not set', async () => {
@ -138,7 +138,7 @@ describe('AssignmentAvailabilityContainer', () => {
const {getByText} = setup({
assignmentOverrides: {nodes: []}
})
expect(getByText('Due Mar 31')).toBeTruthy()
expect(getByText('Due Mar 31, 2021')).toBeTruthy()
})
it('displays no due date when there are no overrides and no due date', () => {
@ -154,10 +154,10 @@ describe('AssignmentAvailabilityContainer', () => {
assignmentOverrides: {nodes: []}
})
expect(queryByText('Due Mar 31')).toBeInTheDocument()
const dueDateTrayButton = queryByText('Due Mar 31')
expect(queryByText('Due Mar 31, 2021')).toBeInTheDocument()
const dueDateTrayButton = queryByText('Due Mar 31, 2021')
fireEvent.click(dueDateTrayButton)
expect(getByText('Due Mar 31')).toBeTruthy()
expect(getByText('Due Mar 31, 2021')).toBeTruthy()
expect(getByTestId('assignment-override-row')).toBeTruthy()
})
@ -167,10 +167,10 @@ describe('AssignmentAvailabilityContainer', () => {
isAdmin: false
})
expect(queryByText('Due Mar 31')).toBeInTheDocument()
const dueDateTrayButton = queryByText('Due Mar 31')
expect(queryByText('Due Mar 31, 2021')).toBeInTheDocument()
const dueDateTrayButton = queryByText('Due Mar 31, 2021')
fireEvent.click(dueDateTrayButton)
expect(getByText('Due Mar 31')).toBeTruthy()
expect(getByText('Due Mar 31, 2021')).toBeTruthy()
expect(queryByTestId('due_date_tray_header_for')).toBeNull()
})
})

View File

@ -69,24 +69,26 @@ describe('AssignmentAvailabilityWindow', () => {
it('should render availability window', () => {
const container = setup(mockProps())
expect(container.getByText('Available from Mar 24 until Apr 4')).toBeInTheDocument()
expect(
container.getByText('Available from Mar 24, 2021 until Apr 4, 2021')
).toBeInTheDocument()
})
it('should render availability window with time', () => {
const container = setup(mockProps({showDateWithTime: true}))
expect(
container.getByText('Available from Mar 24 6am until Apr 4 5:59am')
container.getByText('Available from Mar 24, 2021 6am until Apr 4, 2021 5:59am')
).toBeInTheDocument()
})
it('should render only from section', () => {
const container = setup(mockProps({untilDate: ''}))
expect(container.getByText('Available from Mar 24')).toBeInTheDocument()
expect(container.getByText('Available from Mar 24, 2021')).toBeInTheDocument()
})
it('should render only until section', () => {
const container = setup(mockProps({availableDate: ''}))
expect(container.getByText('Available until Apr 4')).toBeInTheDocument()
expect(container.getByText('Available until Apr 4, 2021')).toBeInTheDocument()
})
})
@ -99,12 +101,14 @@ describe('AssignmentAvailabilityWindow', () => {
it('should not render availability window', () => {
const container = setup(mockProps())
expect(container.queryByText('Available from Mar 24 until Apr 4')).toBeNull()
expect(container.queryByText('Available from Mar 24, 2021 until Apr 4, 2021')).toBeNull()
})
it('should render availability window when showOnMobile is true', () => {
const container = setup(mockProps({showOnMobile: true}))
expect(container.queryByText('Available from Mar 24 until Apr 4')).toBeInTheDocument()
expect(
container.queryByText('Available from Mar 24, 2021 until Apr 4, 2021')
).toBeInTheDocument()
})
})
})

View File

@ -97,8 +97,8 @@ describe('AssignmentDetails', () => {
it('displays due date when there are no overrides', () => {
const {queryByText} = setup()
expect(queryByText('Everyone')).toBeTruthy()
expect(queryByText('Due Mar 31 5:59am')).toBeTruthy()
expect(queryByText('Available from Mar 24 until Apr 4')).toBeTruthy()
expect(queryByText('Due Mar 31, 2021 5:59am')).toBeTruthy()
expect(queryByText('Available from Mar 24, 2021 until Apr 4, 2021')).toBeTruthy()
})
it('displays "Show due dates" button when there are overrides', () => {
@ -111,7 +111,7 @@ describe('AssignmentDetails', () => {
expect(queryByText('Show Due Dates (4)')).toBeTruthy()
fireEvent.click(queryByText('Show Due Dates (4)'))
expect(await findByTestId('due-dates-tray-heading')).toBeTruthy()
expect(await findByText('Sep 4 5:59am')).toBeTruthy()
expect(await findByText('Sep 4, 2021 5:59am')).toBeTruthy()
})
it('correct text is shown when a date is not set', async () => {

View File

@ -56,7 +56,7 @@ describe('AssignmentDueDate', () => {
it('should render due date', () => {
const container = setup(mockProps)
expect(container.getByText('Due Mar 31 5:59am')).toBeInTheDocument()
expect(container.getByText('Due Mar 31, 2021 5:59am')).toBeInTheDocument()
})
it('should not find open due date tray button', () => {
@ -73,7 +73,7 @@ describe('AssignmentDueDate', () => {
it('should render due date', () => {
const container = setup(mockProps)
expect(container.getByText('Due Mar 31')).toBeInTheDocument()
expect(container.getByText('Due Mar 31, 2021')).toBeInTheDocument()
})
it('should find open due date tray button', () => {

View File

@ -89,8 +89,10 @@ describe('AssignmentSingleAvailabilityWindow', () => {
it('should render', () => {
const container = setup({assignmentOverrides: []})
expect(container.getByText('Everyone')).toBeInTheDocument()
expect(container.getByText('Due Mar 31 5:59am')).toBeInTheDocument()
expect(container.getByText('Available from Mar 24 until Apr 4')).toBeInTheDocument()
expect(container.getByText('Due Mar 31, 2021 5:59am')).toBeInTheDocument()
expect(
container.getByText('Available from Mar 24, 2021 until Apr 4, 2021')
).toBeInTheDocument()
})
it('should show participant list when sinlge override is defined with student list', () => {
@ -126,7 +128,7 @@ describe('AssignmentSingleAvailabilityWindow', () => {
it('should render', () => {
const container = setup({assignmentOverrides: []})
expect(container.getByText('Due Mar 31')).toBeInTheDocument()
expect(container.getByText('Due Mar 31, 2021')).toBeInTheDocument()
})
})
})

View File

@ -74,10 +74,10 @@ describe('DueDateTray', () => {
it('displays tray and correctly formatted dates', () => {
const {getByText} = setup()
expect(getByText('Due Dates')).toBeInTheDocument()
expect(getByText('Mar 31 5:59am')).toBeInTheDocument()
expect(getByText('Mar 31, 2021 5:59am')).toBeInTheDocument()
expect(getByText('assignment override 1')).toBeInTheDocument()
expect(getByText('Mar 24 6am')).toBeInTheDocument()
expect(getByText('Apr 4 5:59am')).toBeInTheDocument()
expect(getByText('Mar 24, 2021 6am')).toBeInTheDocument()
expect(getByText('Apr 4, 2021 5:59am')).toBeInTheDocument()
})
it('correct text is shown when a date is not set', () => {
@ -159,10 +159,10 @@ describe('DueDateTray', () => {
it('displays tray and correctly formatted dates', () => {
const {getByText} = setup()
expect(getByText('Mar 31 5:59am')).toBeInTheDocument()
expect(getByText('Mar 31, 2021 5:59am')).toBeInTheDocument()
expect(getByText('assignment override 1')).toBeInTheDocument()
expect(getByText('Mar 24 6am')).toBeInTheDocument()
expect(getByText('Apr 4 5:59am')).toBeInTheDocument()
expect(getByText('Mar 24, 2021 6am')).toBeInTheDocument()
expect(getByText('Apr 4, 2021 5:59am')).toBeInTheDocument()
})
it('correct text is shown when a date is not set', () => {

View File

@ -91,7 +91,7 @@ describe('PeerReview', () => {
}
const {getByText} = render(<PeerReview {...props} />)
expect(getByText('Peer review due Jul 4')).toBeTruthy()
expect(getByText('Peer review due Jul 4, 2021')).toBeTruthy()
})
it('omits the due date when there is not one', () => {

View File

@ -52,7 +52,7 @@ describe('Reply Preview', () => {
it('created at timestamp renders', () => {
const container = setup(mockProps())
expect(container.getByText('Aug 10 6:10pm')).toBeTruthy()
expect(container.getByText('Aug 10, 2021 6:10pm')).toBeTruthy()
})
it('message renders', () => {

View File

@ -48,8 +48,8 @@ describe('DiscussionEntryMessageContainer', () => {
)
expect(container.getByTestId('created-tooltip')).toBeTruthy()
// one for the screenreader, the other for the tooltip
expect(container.getAllByText('Created Feb 8 8:35pm').length).toEqual(2)
expect(container.getByText('Edited by Eddy Tor Apr 13 4pm')).toBeInTheDocument()
expect(container.getAllByText('Created Feb 8, 2021 8:35pm').length).toEqual(2)
expect(container.getByText('Edited by Eddy Tor Apr 13, 2021 4pm')).toBeInTheDocument()
})
it('should display plain edited if author is editor', () => {
@ -63,7 +63,7 @@ describe('DiscussionEntryMessageContainer', () => {
}
})
)
expect(container.getByText('Edited Apr 13 4pm')).toBeInTheDocument()
expect(container.getByText('Edited Apr 13, 2021 4pm')).toBeInTheDocument()
})
it('should not display edit info when no editor', () => {
@ -79,8 +79,8 @@ describe('DiscussionEntryMessageContainer', () => {
it('displays deletion info if delete', () => {
const {getByText} = setup(defaultProps({deleted: true}))
expect(getByText('Deleted by Hank Mccoy')).toBeInTheDocument()
expect(getByText('Created Feb 8 8:35pm')).toBeInTheDocument()
expect(getByText('Deleted Apr 13 4pm')).toBeInTheDocument()
expect(getByText('Created Feb 8, 2021 8:35pm')).toBeInTheDocument()
expect(getByText('Deleted Apr 13, 2021 4pm')).toBeInTheDocument()
})
it('displays discussion entry message', () => {

View File

@ -246,8 +246,8 @@ describe('DiscussionTopicContainer', () => {
permissions: DiscussionPermissions.mock({readAsAdmin: false})
})
})
expect(await container.findByText('Due Mar 31 5:59am')).toBeTruthy()
expect(await container.findByText('Available from Mar 24 until Apr 4')).toBeTruthy()
expect(await container.findByText('Due Mar 31, 2021 5:59am')).toBeTruthy()
expect(await container.findByText('Available from Mar 24, 2021 until Apr 4, 2021')).toBeTruthy()
})
it('Should not be able to see post menu if no permissions and initialPostRequiredForCurrentUser', () => {
@ -449,8 +449,8 @@ describe('DiscussionTopicContainer', () => {
discussionTopic: Discussion.mock({assignment: Assignment.mock({assignmentOverrides: null})})
})
expect(await container.findByText('Everyone')).toBeTruthy()
expect(await container.findByText('Due Mar 31 5:59am')).toBeTruthy()
expect(await container.findByText('Available from Mar 24 until Apr 4')).toBeTruthy()
expect(await container.findByText('Due Mar 31, 2021 5:59am')).toBeTruthy()
expect(await container.findByText('Available from Mar 24, 2021 until Apr 4, 2021')).toBeTruthy()
})
it('Should find "Show Due Dates" link button', async () => {
@ -478,8 +478,8 @@ describe('DiscussionTopicContainer', () => {
props.discussionTopic.assignment.lockAt = null
const container = setup(props)
expect(await container.findByText('assignment override 3')).toBeTruthy()
expect(await container.findByText('Due Apr 5 1:40pm')).toBeTruthy()
expect(await container.findByText('Available from Mar 21 until Sep 4')).toBeTruthy()
expect(await container.findByText('Due Apr 5, 2021 1:40pm')).toBeTruthy()
expect(await container.findByText('Available from Mar 21, 2021 until Sep 4, 2021')).toBeTruthy()
})
it('Should find no due date text for "assignment override 3"', async () => {
@ -503,7 +503,7 @@ describe('DiscussionTopicContainer', () => {
expect(container.getByText('assignment override 3')).toBeTruthy()
expect(container.getByText('No Due Date')).toBeTruthy()
expect(container.getByText('Available from Mar 21 until Sep 4')).toBeTruthy()
expect(container.getByText('Available from Mar 21, 2021 until Sep 4, 2021')).toBeTruthy()
})
it('Should find no available date text for "assignment override 3"', async () => {
@ -526,8 +526,8 @@ describe('DiscussionTopicContainer', () => {
const container = setup(props)
expect(container.getByText('assignment override 3')).toBeTruthy()
expect(container.getByText('Due Apr 5 1:40pm')).toBeTruthy()
expect(container.getByText('Available until Sep 4')).toBeTruthy()
expect(container.getByText('Due Apr 5, 2021 1:40pm')).toBeTruthy()
expect(container.getByText('Available until Sep 4, 2021')).toBeTruthy()
})
it('Should find no until date text for "assignment override 3"', async () => {
@ -550,8 +550,8 @@ describe('DiscussionTopicContainer', () => {
const container = setup(props)
expect(container.getByText('assignment override 3')).toBeTruthy()
expect(container.getByText('Due Apr 5 1:40pm')).toBeTruthy()
expect(container.getByText('Available from Mar 21')).toBeTruthy()
expect(container.getByText('Due Apr 5, 2021 1:40pm')).toBeTruthy()
expect(container.getByText('Available from Mar 21, 2021')).toBeTruthy()
})
it('Should find no text after due date text for "assignment override 3"', async () => {
@ -574,7 +574,7 @@ describe('DiscussionTopicContainer', () => {
const container = setup(props)
expect(container.getByText('assignment override 3')).toBeTruthy()
expect(container.getByText('Due Apr 5 1:40pm')).toBeTruthy()
expect(container.getByText('Due Apr 5, 2021 1:40pm')).toBeTruthy()
})
it('should show availability window for ungraded discussions', () => {
@ -586,7 +586,9 @@ describe('DiscussionTopicContainer', () => {
})
})
expect(container.getByText('Available from Mar 21 6am until Sep 4 5:59am')).toBeTruthy()
expect(
container.getByText('Available from Mar 21, 2021 6am until Sep 4, 2021 5:59am')
).toBeTruthy()
})
it('Renders an alert if initialPostRequiredForCurrentUser is true', () => {
@ -629,7 +631,7 @@ describe('DiscussionTopicContainer', () => {
})
}
const container = setup(props)
expect(container.getByText(`Edited by Eddy Tor Apr 22 6:41pm`)).toBeInTheDocument()
expect(container.getByText(`Edited by Eddy Tor Apr 22, 2021 6:41pm`)).toBeInTheDocument()
expect(container.queryByTestId('created-tooltip')).toBeFalsy()
})
@ -645,7 +647,7 @@ describe('DiscussionTopicContainer', () => {
})
}
const container = setup(props)
expect(container.getByText(`Edited Apr 22 6:41pm`)).toBeInTheDocument()
expect(container.getByText(`Edited Apr 22, 2021 6:41pm`)).toBeInTheDocument()
expect(container.queryByTestId('created-tooltip')).toBeFalsy()
})
@ -691,7 +693,7 @@ describe('DiscussionTopicContainer', () => {
const props = {discussionTopic: Discussion.mock()}
const {getByText} = setup(props)
expect(getByText('Peer review for Morty Smith Due: Mar 31 5:59am')).toBeTruthy()
expect(getByText('Peer review for Morty Smith Due: Mar 31, 2021 5:59am')).toBeTruthy()
})
it('renders with out a due date', () => {
@ -716,7 +718,7 @@ describe('DiscussionTopicContainer', () => {
}
const {queryByText} = setup(props)
expect(queryByText('eer review for Morty Smith Due: Mar 31 5:59am')).toBeNull()
expect(queryByText('eer review for Morty Smith Due: Mar 31, 2021 5:59am')).toBeNull()
})
describe('PodcastFeed Button', () => {

View File

@ -91,7 +91,7 @@ describe('DateTimeInput::', () => {
fireEvent.input(dateInput, {target: {value: 'Apr 10'}})
fireEvent.blur(dateInput)
const callbackParm = onChange.mock.calls[0][0]
expect(callbackParm).toBe('2021-04-10T15:00:00.000Z')
expect(callbackParm).toBe('2022-04-10T15:00:00.000Z')
rerender(<DateTimeInput {...props} onChange={onChange} value={callbackParm} />)
await waitFor(() => expect(queryAllByText('Sat, April 10, 2021, 5:00 AM')).not.toBeNull())
})

View File

@ -33,7 +33,7 @@ describe('MicrosoftSync', () => {
const subject = overrides => render(<MicrosoftSync {...props(overrides)} />)
it('displays the last sync time', () => {
expect(subject().getByText(/Mar 3/).textContent).toEqual(' Mar 30 at 8:44pm')
expect(subject().getByText(/Mar 3/).textContent).toEqual(' Mar 30, 2021 at 8:44pm')
})
it('displays the workflow state', () => {