本文整理汇总了TypeScript中test-utils/timetable.createGenericLesson函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createGenericLesson函数的具体用法?TypeScript createGenericLesson怎么用?TypeScript createGenericLesson使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createGenericLesson函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('areOtherClassesAvailable', () => {
// Lessons belong to different ClassNo.
const lessons1: RawLesson[] = _.shuffle([
createGenericLesson('Monday', '1000', '1200', 'Lecture', '1'),
createGenericLesson('Monday', '1600', '1800', 'Lecture', '2'),
createGenericLesson('Monday', '1400', '1500', 'Lecture', '3'),
]);
expect(areOtherClassesAvailable(lessons1, 'Lecture')).toBe(true);
expect(areOtherClassesAvailable(lessons1, 'Tutorial')).toBe(false);
// Lessons belong to the same ClassNo.
const lessons2: RawLesson[] = _.shuffle([
createGenericLesson('Monday', '1000', '1200', 'Lecture', '1'),
createGenericLesson('Monday', '1600', '1800', 'Lecture', '1'),
createGenericLesson('Monday', '1400', '1500', 'Lecture', '1'),
]);
expect(areOtherClassesAvailable(lessons2, 'Lecture')).toBe(false);
// Lessons belong to different lessonType.
const lessons3: RawLesson[] = _.shuffle([
createGenericLesson('Monday', '1000', '1200', 'Lecture', '1'),
createGenericLesson('Monday', '1600', '1800', 'Lecture', '1'),
createGenericLesson('Monday', '1400', '1500', 'Tutorial', '1'),
createGenericLesson('Monday', '1400', '1500', 'Tutorial', '2'),
]);
expect(areOtherClassesAvailable(lessons3, 'Lecture')).toBe(false);
expect(areOtherClassesAvailable(lessons3, 'Tutorial')).toBe(true);
});
示例2: test
test('calculate default border timings correctly', () => {
const timings = calculateBorderTimings([
createGenericLesson('Anyday', '1100', '1230'),
createGenericLesson('Anyday', '1330', '1400'),
createGenericLesson('Anyday', '1300', '1500'),
]);
expect(timings.startingIndex).toBe(convertTimeToIndex(DEFAULT_EARLIEST_TIME));
expect(timings.endingIndex).toBe(convertTimeToIndex(DEFAULT_LATEST_TIME));
});
示例3: testLessonAvailable
function testLessonAvailable(weeks: Weeks, date: Date) {
return isLessonAvailable(
{ ...createGenericLesson(), weeks },
date,
NUSModerator.academicCalendar.getAcadWeekInfo(date),
);
}