本文整理匯總了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),
);
}