-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.js
More file actions
40 lines (29 loc) · 1.45 KB
/
Test.js
File metadata and controls
40 lines (29 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function resourcesCanBeFound()
{
const form = FormApp.getActiveForm();
form.getItems().forEach(function (i) { Logger.log("%s: %s", i.getId().toString(), i.getTitle()) });
for (var id in itemIdLookup)
if (!form.getItemById(id)) Logger.log("ERROR: Item with id %s does not exist", id.toString());
if(!FormApp.openById(templateSignupForm))
Logger.log("ERROR: template sign-up form not found")
if(!SpreadsheetApp.openById(templateResponsesSheet))
Logger.log("ERROR: template responses sheet not found")
const calendar = CalendarApp.getCalendarById(targetCalendar)
if (!calendar)
Logger.log("ERROR: Target calendar does not exist");
var event = calendar.createEvent("TEST", new Date(2001, 0, 1, 0, 0), new Date(2001, 0, 1, 1, 0))
if(calendar.getEventsForDay(new Date(2001, 0, 1)).filter(function(e) { return e.getTitle() == "TEST" }).length == 0)
Logger.log("ERROR: Created a calendar event but it couldn't be found.")
event.deleteEvent()
if (!DriveApp.getFolderById(targetFolder))
Logger.log("ERROR: Target Drive folder does not exist");
const ss = SpreadsheetApp.create("A test spreadsheet")
moveToTargetFolder(ss)
DriveApp.removeFile(DriveApp.getFileById(ss.getId()))
if (!DriveApp.getFolderById(targetFolder))
Logger.log("ERROR: Target Drive folder does not exist");
Logger.log("OK");
}
function testProperties() {
console.info(PropertiesService.getDocumentProperties().getProperties())
}