Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchadwick committed Jun 12, 2024
1 parent 21e5c5c commit b66685d
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,22 @@ module('Integration | Component | curriculum-inventory/report-list-item', functi
assert.strictEqual(component.name, 'CI Report');
assert.strictEqual(component.program, 'program 0');
assert.strictEqual(component.year, '2017');
assert.strictEqual(component.startDate, this.intl.formatDate(this.report.startDate));
assert.strictEqual(component.endDate, this.intl.formatDate(this.report.endDate));
assert.strictEqual(
component.startDate,
this.intl.formatDate(this.report.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.endDate,
this.intl.formatDate(this.report.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.status, 'Draft');
assert.ok(component.isDeletable);
assert.notOk(component.confirmRemoval.isVisible);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,20 @@ module('Integration | Component | curriculum-inventory/report-list', function (h
assert.strictEqual(component.reports[0].year, '2016', 'Academic year shows.');
assert.strictEqual(
component.reports[0].startDate,
this.intl.formatDate(reportModel2.startDate),
this.intl.formatDate(reportModel2.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date shows.',
);
assert.strictEqual(
component.reports[0].endDate,
this.intl.formatDate(reportModel2.endDate),
this.intl.formatDate(reportModel2.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date shows.',
);
assert.strictEqual(component.reports[0].status, 'Finalized', 'Status shows.');
Expand All @@ -110,12 +118,20 @@ module('Integration | Component | curriculum-inventory/report-list', function (h
assert.strictEqual(component.reports[1].year, '2017', 'Academic year shows.');
assert.strictEqual(
component.reports[1].startDate,
this.intl.formatDate(reportModel1.startDate),
this.intl.formatDate(reportModel1.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date shows.',
);
assert.strictEqual(
component.reports[1].endDate,
this.intl.formatDate(reportModel1.endDate),
this.intl.formatDate(reportModel1.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date shows.',
);
assert.strictEqual(component.reports[1].status, 'Draft', 'Status shows.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
assert.strictEqual(component.startDate.label, 'Start:', 'Start date label is correct.');
assert.strictEqual(
component.startDate.text,
this.intl.formatDate(reportModel.startDate),
this.intl.formatDate(reportModel.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date is visible.',
);
assert.strictEqual(component.endDate.label, 'End:', 'End date label is correct.');
assert.strictEqual(
component.endDate.text,
this.intl.formatDate(reportModel.endDate),
this.intl.formatDate(reportModel.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date is visible.',
);
assert.strictEqual(
Expand Down Expand Up @@ -101,12 +109,20 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
);
assert.strictEqual(
component.startDate.readOnlyText,
this.intl.formatDate(reportModel.startDate),
this.intl.formatDate(reportModel.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date is visible.',
);
assert.strictEqual(
component.endDate.readOnlyText,
this.intl.formatDate(reportModel.endDate),
this.intl.formatDate(reportModel.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date is visible.',
);
assert.strictEqual(
Expand Down Expand Up @@ -203,7 +219,11 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
await component.startDate.save();
assert.strictEqual(
component.startDate.text,
this.intl.formatDate(newVal),
this.intl.formatDate(newVal, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Edit link shown new start date post-update.',
);
assert.strictEqual(
Expand Down Expand Up @@ -248,7 +268,11 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
await component.endDate.save();
assert.strictEqual(
component.endDate.text,
this.intl.formatDate(newVal),
this.intl.formatDate(newVal, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Edit link shown new end date post-update.',
);
assert.strictEqual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,19 @@ module('Integration | Component | curriculum-inventory/sequence-block-list-item'
assert.strictEqual(component.orderInSequence, '3');
assert.strictEqual(
component.startDate,
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 3, day: 17 }).toJSDate()),
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 3, day: 17 }).toJSDate(), {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.endDate,
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 5, day: 22 }).toJSDate()),
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 5, day: 22 }).toJSDate(), {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.course, 'course 0');
assert.ok(component.isDeletable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,19 @@ module('Integration | Component | curriculum-inventory/sequence-block-list', fun
assert.strictEqual(component.list.items[1].orderInSequence, 'n/a');
assert.strictEqual(
component.list.items[1].startDate,
this.intl.formatDate(this.sequenceBlock1.startDate),
this.intl.formatDate(this.sequenceBlock1.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.list.items[1].endDate,
this.intl.formatDate(this.sequenceBlock1.endDate),
this.intl.formatDate(this.sequenceBlock1.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.list.items[1].course, this.course.title);
assert.ok(component.list.items[1].isDeletable);
Expand Down Expand Up @@ -190,11 +198,19 @@ module('Integration | Component | curriculum-inventory/sequence-block-list', fun
assert.strictEqual(component.list.items[1].orderInSequence, 'n/a');
assert.strictEqual(
component.list.items[1].startDate,
this.intl.formatDate(this.sequenceBlock1.startDate),
this.intl.formatDate(this.sequenceBlock1.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.list.items[1].endDate,
this.intl.formatDate(this.sequenceBlock1.endDate),
this.intl.formatDate(this.sequenceBlock1.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.list.items[1].course, this.course.title);
assert.ok(component.list.items[1].isDeletable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
assert.ok(component.description.isEditable);
assert.strictEqual(
component.course.text,
`Course: Course A Level: 4, Start Date: 2/2/2015, End Date: 3/30/2015 - Clerkship (Block)`,
`Course: Course A Level: 4, Start Date: 02/02/2015, End Date: 03/30/2015 - Clerkship (Block)`,
);
assert.ok(component.course.isEditable);
const startLevel = await sequenceBlockModel.startingAcademicLevel;
Expand All @@ -128,9 +128,9 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
assert.strictEqual(component.track.label, 'Is Track:');
assert.strictEqual(component.track.yesNoToggle.checked, 'true');
assert.ok(component.track.isEditable);
assert.strictEqual(component.startDate.text, 'Start: 1/2/2015');
assert.strictEqual(component.startDate.text, 'Start: 01/02/2015');
assert.ok(component.startDate.isEditable);
assert.strictEqual(component.endDate.text, 'End: 4/30/2015');
assert.strictEqual(component.endDate.text, 'End: 04/30/2015');
assert.ok(component.endDate.isEditable);
assert.strictEqual(
component.duration.text,
Expand Down Expand Up @@ -295,15 +295,15 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
/>`);
assert.strictEqual(
component.course.text,
`Course: Alpha Level: 1, Start Date: 1/1/2016, End Date: 1/2/2016 - Clerkship (clerkship type 0)`,
`Course: Alpha Level: 1, Start Date: 01/01/2016, End Date: 01/02/2016 - Clerkship (clerkship type 0)`,
);
await component.course.edit();
assert.strictEqual(component.course.options.length, 4);
assert.strictEqual(component.course.options[0].text, 'Select a Course');
assert.strictEqual(component.course.options[1].text, 'Alpha');
assert.strictEqual(
component.course.details,
'Level: 1, Start Date: 1/1/2016, End Date: 1/2/2016 - Clerkship (clerkship type 0)',
'Level: 1, Start Date: 01/01/2016, End Date: 01/02/2016 - Clerkship (clerkship type 0)',
);
assert.strictEqual(component.course.options[1].value, courseModel.id);
assert.ok(component.course.options[1].isSelected);
Expand All @@ -312,12 +312,12 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
await component.course.select(newCourseModel.id);
assert.strictEqual(
component.course.details,
'Level: 1, Start Date: 3/1/2016, End Date: 3/2/2016 - Clerkship (clerkship type 0)',
'Level: 1, Start Date: 03/01/2016, End Date: 03/02/2016 - Clerkship (clerkship type 0)',
);
await component.course.save();
assert.strictEqual(
component.course.text,
'Course: Gamma Level: 1, Start Date: 3/1/2016, End Date: 3/2/2016 - Clerkship (clerkship type 0)',
'Course: Gamma Level: 1, Start Date: 03/01/2016, End Date: 03/02/2016 - Clerkship (clerkship type 0)',
);
const blockCourse = await sequenceBlockModel.course;
assert.strictEqual(blockCourse.id, newCourse.id);
Expand Down Expand Up @@ -770,7 +770,7 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
assert.notOk(component.description.isEditable);
assert.strictEqual(
component.course.text,
`Course: Course A Level: 4, Start Date: 2/2/2015, End Date: 3/30/2015 - Clerkship (Block)`,
`Course: Course A Level: 4, Start Date: 02/02/2015, End Date: 03/30/2015 - Clerkship (Block)`,
);
assert.notOk(component.course.isEditable);
assert.strictEqual(component.startLevel.text, 'Start Level: Year 1');
Expand All @@ -781,9 +781,9 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
assert.notOk(component.required.isEditable);
assert.strictEqual(component.track.text, 'Is Track: Yes');
assert.notOk(component.track.isEditable);
assert.strictEqual(component.startDate.text, 'Start: 1/2/2015');
assert.strictEqual(component.startDate.text, 'Start: 01/02/2015');
assert.notOk(component.startDate.isEditable);
assert.strictEqual(component.endDate.text, 'End: 4/30/2015');
assert.strictEqual(component.endDate.text, 'End: 04/30/2015');
assert.notOk(component.endDate.isEditable);
assert.strictEqual(
component.duration.text,
Expand Down Expand Up @@ -1244,7 +1244,7 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
await component.durationEditor.save();
assert.strictEqual(component.startDate.text, 'Start: 10/30/2016');
assert.ok(component.startDate.isEditable);
assert.strictEqual(component.endDate.text, 'End: 11/2/2016');
assert.strictEqual(component.endDate.text, 'End: 11/02/2016');
assert.ok(component.endDate.isEditable);
assert.strictEqual(
component.duration.text,
Expand Down Expand Up @@ -1301,7 +1301,7 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
await component.durationEditor.save();
assert.strictEqual(component.startDate.text, 'Start: 10/30/2016');
assert.ok(component.startDate.isEditable);
assert.strictEqual(component.endDate.text, 'End: 11/2/2016');
assert.strictEqual(component.endDate.text, 'End: 11/02/2016');
assert.strictEqual(component.duration.text, `Duration (in Days): Click to edit`);

const { startDate, endDate, duration } = sequenceBlockModel;
Expand Down Expand Up @@ -1396,9 +1396,9 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
@setSortBy={{(noop)}}
/>`);

assert.strictEqual(component.startDate.text, 'Start: 4/23/2016');
assert.strictEqual(component.startDate.text, 'Start: 04/23/2016');
assert.ok(component.startDate.isEditable);
assert.strictEqual(component.endDate.text, 'End: 6/22/2016');
assert.strictEqual(component.endDate.text, 'End: 06/22/2016');
assert.ok(component.endDate.isEditable);
assert.strictEqual(
component.duration.text,
Expand All @@ -1409,9 +1409,9 @@ module('Integration | Component | curriculum-inventory/sequence-block-overview',
await component.durationEditor.endDate.set('2016-11-02');
await component.durationEditor.duration.set(newDuration);
await component.durationEditor.cancel();
assert.strictEqual(component.startDate.text, 'Start: 4/23/2016');
assert.strictEqual(component.startDate.text, 'Start: 04/23/2016');
assert.ok(component.startDate.isEditable);
assert.strictEqual(component.endDate.text, 'End: 6/22/2016');
assert.strictEqual(component.endDate.text, 'End: 06/22/2016');
assert.strictEqual(
component.duration.text,
`Duration (in Days): ${sequenceBlockModel.duration}`,
Expand Down

0 comments on commit b66685d

Please sign in to comment.