Created
July 3, 2020 17:14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-node | |
const fileName = "CalendarWorkWeeks.mpp"; | |
const localPath = "./Data/" + fileName; | |
const remotePath = "Temp/Data"; | |
const remoteFullPath = remotePath + "/" + fileName; | |
await tasksApi.uploadFileToStorage(remoteFullPath, localPath); | |
const request = new GetCalendarsRequest(); | |
request.name = fileName; | |
request.folder = remotePath; | |
const result = await tasksApi.getCalendars(request); | |
expect(result.response.statusCode).to.equal(200); | |
expect(result.body.calendars.list).is.not.null.and.undefined; | |
const calendarUid = result.body.calendars.list.find(c => c.name === "Test work weeks").uid; | |
const request2 = new GetCalendarWorkWeeksRequest(); | |
request2.name = fileName; | |
request2.folder = remotePath; | |
request2.calendarUid = calendarUid; | |
const result2 = await tasksApi.getCalendarWorkWeeks(request2); | |
expect(result2.response.statusCode).to.equal(200); | |
expect(result2.body.calendarWorkWeeks).is.not.null.and.undefined; | |
expect(result2.body.calendarWorkWeeks.length).to.equal(1); | |
const workWeek = result2.body.calendarWorkWeeks[0]; | |
expect(workWeek.name).to.equal("Work week 1"); | |
expect(BaseTest.getDateOnly(workWeek.fromDate)).to.eql(BaseTest.getDateOnly(new Date(2018, 0, 1))); | |
expect(BaseTest.getDateOnly(workWeek.toDate)).to.eql(BaseTest.getDateOnly(new Date(2018, 0, 7, 8))); | |
expect(workWeek.weekDays.length).to.equal(4); | |
expect(workWeek.weekDays[0].dayWorking).is.true; | |
expect(workWeek.weekDays[0].dayType).to.equal(DayType.Monday); | |
expect(workWeek.weekDays[0].workingTimes.length).to.equal(1); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[0].workingTimes[0].fromTime)).to.eql(new Date(Date.UTC(0, 0, 0, 11, 30, 0))); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[0].workingTimes[0].toTime)).to.eql(new Date(Date.UTC(0, 0, 0, 12, 30, 0))); | |
expect(workWeek.weekDays[1].dayWorking).is.false; | |
expect(workWeek.weekDays[1].dayType).to.equal(DayType.Tuesday); | |
expect(workWeek.weekDays[1].workingTimes.length).to.equal(0); | |
expect(workWeek.weekDays[2].dayWorking).is.true; | |
expect(workWeek.weekDays[2].dayType).to.equal(DayType.Wednesday); | |
expect(workWeek.weekDays[2].workingTimes.length).to.equal(2); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[2].workingTimes[0].fromTime)).to.eql(new Date(Date.UTC(0, 0, 0, 9, 30, 0))); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[2].workingTimes[0].toTime)).to.eql(new Date(Date.UTC(0, 0, 0, 13, 23, 0))); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[2].workingTimes[1].fromTime)).to.eql(new Date(Date.UTC(0, 0, 0, 14, 45, 0))); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[2].workingTimes[1].toTime)).to.eql(new Date(Date.UTC(0, 0, 0, 18, 45, 0))); | |
expect(workWeek.weekDays[3].dayWorking).is.true; | |
expect(workWeek.weekDays[3].dayType).to.equal(DayType.Saturday); | |
expect(workWeek.weekDays[3].workingTimes.length).to.equal(1); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[3].workingTimes[0].fromTime)).to.eql(new Date(Date.UTC(0, 0, 0, 9, 0, 0))); | |
expect(BaseTest.getTimeOnly(workWeek.weekDays[3].workingTimes[0].toTime)).to.eql(new Date(Date.UTC(0, 0, 0, 10, 0, 0))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment