add linting in CI + fix lint errors (#473)
* run `yarn lint --fix`
* Revert "Revert "add linting to ci""
This reverts commit 0bbbbee4be.
* Fixed some errors
* remove unused code - not sure why this was here?
* assert env var
* more type fixes
* fix typings og gcal callback - needs testing
* rename `md5.ts` to `md5.js`
it is js.
* fix types
* fix types
* fix lint errors
* fix last lint error
Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
1 parent
5a9961f608
commit
f63aa5d550
36 files changed
+988
-959
No files matched your search
+8
-25
@@ -7,14 +7,11 @@ it("can decorate using whereAndSelect", async () => {
|
||||
expect(queryObj).toStrictEqual({ where: { id: 1 }, select: { example: true } });
|
||||
},
|
||||
{ id: 1 },
|
||||
[
|
||||
"example",
|
||||
]
|
||||
["example"]
|
||||
);
|
||||
});
|
||||
|
||||
it("can do nested selects using . seperator", async () => {
|
||||
|
||||
whereAndSelect(
|
||||
(queryObj) => {
|
||||
expect(queryObj).toStrictEqual({
|
||||
@@ -33,11 +30,7 @@ it("can do nested selects using . seperator", async () => {
|
||||
});
|
||||
},
|
||||
{ uid: 1 },
|
||||
[
|
||||
"description",
|
||||
"attendees.email",
|
||||
"attendees.name",
|
||||
]
|
||||
["description", "attendees.email", "attendees.name"]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -55,7 +48,7 @@ it("can handle nesting deeply", async () => {
|
||||
email: {
|
||||
select: {
|
||||
nested: true,
|
||||
}
|
||||
},
|
||||
},
|
||||
name: true,
|
||||
},
|
||||
@@ -64,11 +57,7 @@ it("can handle nesting deeply", async () => {
|
||||
});
|
||||
},
|
||||
{ uid: 1 },
|
||||
[
|
||||
"description",
|
||||
"attendees.email.nested",
|
||||
"attendees.name",
|
||||
]
|
||||
["description", "attendees.email.nested", "attendees.name"]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -91,18 +80,12 @@ it("can handle nesting multiple", async () => {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
{ uid: 1 },
|
||||
[
|
||||
"description",
|
||||
"attendees.email",
|
||||
"attendees.name",
|
||||
"bookings.id",
|
||||
"bookings.name",
|
||||
]
|
||||
["description", "attendees.email", "attendees.name", "bookings.id", "bookings.name"]
|
||||
);
|
||||
});
|
||||
+37
-37
@@ -8,50 +8,50 @@ import timezone from "dayjs/plugin/timezone";
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
MockDate.set('2021-06-20T11:59:59Z');
|
||||
MockDate.set("2021-06-20T11:59:59Z");
|
||||
|
||||
it('can fit 24 hourly slots for an empty day', async () => {
|
||||
it("can fit 24 hourly slots for an empty day", async () => {
|
||||
// 24h in a day.
|
||||
expect(getSlots({
|
||||
inviteeDate: dayjs().add(1, 'day'),
|
||||
frequency: 60,
|
||||
workingHours: [
|
||||
{ days: [...Array(7).keys()], startTime: 0, endTime: 1440 }
|
||||
],
|
||||
organizerTimeZone: 'Europe/London'
|
||||
})).toHaveLength(24);
|
||||
expect(
|
||||
getSlots({
|
||||
inviteeDate: dayjs().add(1, "day"),
|
||||
frequency: 60,
|
||||
workingHours: [{ days: [...Array(7).keys()], startTime: 0, endTime: 1440 }],
|
||||
organizerTimeZone: "Europe/London",
|
||||
})
|
||||
).toHaveLength(24);
|
||||
});
|
||||
|
||||
it('only shows future booking slots on the same day', async () => {
|
||||
it("only shows future booking slots on the same day", async () => {
|
||||
// The mock date is 1s to midday, so 12 slots should be open given 0 booking notice.
|
||||
expect(getSlots({
|
||||
inviteeDate: dayjs(),
|
||||
frequency: 60,
|
||||
workingHours: [
|
||||
{ days: [...Array(7).keys()], startTime: 0, endTime: 1440 }
|
||||
],
|
||||
organizerTimeZone: 'GMT'
|
||||
})).toHaveLength(12);
|
||||
expect(
|
||||
getSlots({
|
||||
inviteeDate: dayjs(),
|
||||
frequency: 60,
|
||||
workingHours: [{ days: [...Array(7).keys()], startTime: 0, endTime: 1440 }],
|
||||
organizerTimeZone: "GMT",
|
||||
})
|
||||
).toHaveLength(12);
|
||||
});
|
||||
|
||||
it('can cut off dates that due to invitee timezone differences fall on the next day', async () => {
|
||||
expect(getSlots({
|
||||
inviteeDate: dayjs().tz('Europe/Amsterdam').startOf('day'), // time translation +01:00
|
||||
frequency: 60,
|
||||
workingHours: [
|
||||
{ days: [0], startTime: 1380, endTime: 1440 }
|
||||
],
|
||||
organizerTimeZone: 'Europe/London'
|
||||
})).toHaveLength(0);
|
||||
it("can cut off dates that due to invitee timezone differences fall on the next day", async () => {
|
||||
expect(
|
||||
getSlots({
|
||||
inviteeDate: dayjs().tz("Europe/Amsterdam").startOf("day"), // time translation +01:00
|
||||
frequency: 60,
|
||||
workingHours: [{ days: [0], startTime: 1380, endTime: 1440 }],
|
||||
organizerTimeZone: "Europe/London",
|
||||
})
|
||||
).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('can cut off dates that due to invitee timezone differences fall on the previous day', async () => {
|
||||
expect(getSlots({
|
||||
inviteeDate: dayjs().startOf('day'), // time translation -01:00
|
||||
frequency: 60,
|
||||
workingHours: [
|
||||
{ days: [0], startTime: 0, endTime: 60 }
|
||||
],
|
||||
organizerTimeZone: 'Europe/London'
|
||||
})).toHaveLength(0);
|
||||
it("can cut off dates that due to invitee timezone differences fall on the previous day", async () => {
|
||||
expect(
|
||||
getSlots({
|
||||
inviteeDate: dayjs().startOf("day"), // time translation -01:00
|
||||
frequency: 60,
|
||||
workingHours: [{ days: [0], startTime: 0, endTime: 60 }],
|
||||
organizerTimeZone: "Europe/London",
|
||||
})
|
||||
).toHaveLength(0);
|
||||
});
|
||||
Reference in new issue
Block a user