Skip to content

Commit 6ffb754

Browse files
committed
fix format issues
1 parent 095237c commit 6ffb754

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

packages/adapter-drizzle/tests/timezone-edge-cases.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("Timezone Edge Cases", () => {
3232
it("should handle dates with explicit timezone offsets", async () => {
3333
// User passes date with timezone offset
3434
const dateWithOffset = new Date("2024-01-15T14:00:00+02:00") // 2 PM in +2 timezone = 12 PM UTC
35-
35+
3636
const job = await adapter.addJob({
3737
name: "offset-test",
3838
payload: { test: "data" },
@@ -53,7 +53,7 @@ describe("Timezone Edge Cases", () => {
5353
it("should handle negative timezone offsets", async () => {
5454
// User passes date with negative timezone offset
5555
const dateWithNegativeOffset = new Date("2024-01-15T14:00:00-05:00") // 2 PM EST = 7 PM UTC
56-
56+
5757
const job = await adapter.addJob({
5858
name: "negative-offset-test",
5959
payload: { test: "data" },
@@ -75,7 +75,7 @@ describe("Timezone Edge Cases", () => {
7575
// Simulate server running in different timezone by creating dates in different ways
7676
const utcDate = new Date("2024-01-15T14:00:00Z") // Explicit UTC
7777
const localDate = new Date("2024-01-15T14:00:00") // Local time (depends on server timezone)
78-
78+
7979
const utcJob = await adapter.addJob({
8080
name: "utc-job",
8181
payload: { type: "utc" },
@@ -89,7 +89,7 @@ describe("Timezone Edge Cases", () => {
8989
})
9090

9191
const localJob = await adapter.addJob({
92-
name: "local-job",
92+
name: "local-job",
9393
payload: { type: "local" },
9494
status: "pending",
9595
priority: 2,
@@ -102,7 +102,7 @@ describe("Timezone Edge Cases", () => {
102102

103103
// UTC date should be stored exactly as provided
104104
expect(utcJob.processAt.toISOString()).toBe("2024-01-15T14:00:00.000Z")
105-
105+
106106
// Local date gets stored as whatever the server interprets it as
107107
// This is the key test - we store whatever Date object represents in UTC
108108
expect(localJob.processAt).toBeInstanceOf(Date)
@@ -112,8 +112,8 @@ describe("Timezone Edge Cases", () => {
112112
it("should handle daylight saving time transitions", async () => {
113113
// Spring forward: March 10, 2024 in America/New_York
114114
const springForwardDate = new Date("2024-03-10T07:00:00Z") // 2 AM EST becomes 3 AM EDT
115-
116-
// Fall back: November 3, 2024 in America/New_York
115+
116+
// Fall back: November 3, 2024 in America/New_York
117117
const fallBackDate = new Date("2024-11-03T06:00:00Z") // 2 AM EDT becomes 1 AM EST
118118

119119
const springJob = await adapter.addJob({
@@ -131,7 +131,7 @@ describe("Timezone Edge Cases", () => {
131131
const fallJob = await adapter.addJob({
132132
name: "fall-job",
133133
payload: { dst: "fall" },
134-
status: "pending",
134+
status: "pending",
135135
priority: 2,
136136
attempts: 0,
137137
maxAttempts: 3,
@@ -150,28 +150,28 @@ describe("Timezone Edge Cases", () => {
150150
{
151151
name: "ISO with Z",
152152
date: new Date("2024-01-15T14:00:00Z"),
153-
expected: "2024-01-15T14:00:00.000Z"
153+
expected: "2024-01-15T14:00:00.000Z",
154154
},
155155
{
156156
name: "ISO with +00:00",
157157
date: new Date("2024-01-15T14:00:00+00:00"),
158-
expected: "2024-01-15T14:00:00.000Z"
158+
expected: "2024-01-15T14:00:00.000Z",
159159
},
160160
{
161161
name: "ISO with +02:00",
162162
date: new Date("2024-01-15T14:00:00+02:00"),
163-
expected: "2024-01-15T12:00:00.000Z" // 2 hours earlier in UTC
163+
expected: "2024-01-15T12:00:00.000Z", // 2 hours earlier in UTC
164164
},
165165
{
166166
name: "ISO with -05:00",
167167
date: new Date("2024-01-15T14:00:00-05:00"),
168-
expected: "2024-01-15T19:00:00.000Z" // 5 hours later in UTC
168+
expected: "2024-01-15T19:00:00.000Z", // 5 hours later in UTC
169169
},
170170
{
171171
name: "Timestamp",
172172
date: new Date(1705327200000), // 2024-01-15T14:00:00Z
173-
expected: "2024-01-15T14:00:00.000Z"
174-
}
173+
expected: "2024-01-15T14:00:00.000Z",
174+
},
175175
]
176176

177177
for (const testCase of testCases) {
@@ -195,7 +195,7 @@ describe("Timezone Edge Cases", () => {
195195
// Test that what goes in comes out exactly the same
196196
const originalTimestamp = 1705327200000 // 2024-01-15T14:00:00Z
197197
const originalDate = new Date(originalTimestamp)
198-
198+
199199
const job = await adapter.addJob({
200200
name: "consistency-test",
201201
payload: { test: "data" },
@@ -210,9 +210,9 @@ describe("Timezone Edge Cases", () => {
210210

211211
// Retrieve the job
212212
const retrievedJob = await adapter.getNextJob()
213-
213+
214214
expect(retrievedJob).toBeTruthy()
215215
expect(retrievedJob?.processAt.getTime()).toBe(originalTimestamp)
216216
expect(retrievedJob?.processAt.toISOString()).toBe(originalDate.toISOString())
217217
})
218-
})
218+
})

packages/adapter-drizzle/tests/utc-storage.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("UTC Storage Verification", () => {
3131

3232
it("should store all timestamps as UTC in database", async () => {
3333
const now = new Date()
34-
34+
3535
// Add job with timezone context
3636
const job = await adapter.addJob({
3737
name: "timezone-test",
@@ -50,23 +50,23 @@ describe("UTC Storage Verification", () => {
5050

5151
// Verify the job was stored
5252
expect(job.processAt).toBeInstanceOf(Date)
53-
53+
5454
// The key test: processAt should be the exact UTC time we provided
5555
expect(job.processAt.toISOString()).toBe("2024-01-15T14:00:00.000Z")
56-
56+
5757
// Verify no timezone field exists
5858
expect(job).not.toHaveProperty("timezone")
59-
59+
6060
// Verify createdAt is also UTC
6161
expect(job.createdAt.getTimezoneOffset()).toBe(new Date().getTimezoneOffset()) // Should be system UTC
6262
})
6363

6464
it("should handle cron jobs with timezone conversion at creation", async () => {
6565
// This simulates what happens when user adds a cron job with timezone
6666
const processAt = new Date("2024-01-15T14:00:00Z") // Pre-converted to UTC
67-
67+
6868
const job = await adapter.addJob({
69-
name: "cron-timezone-test",
69+
name: "cron-timezone-test",
7070
payload: { timezone: "America/New_York" }, // Timezone info in payload only
7171
status: "delayed",
7272
priority: 2,
@@ -91,7 +91,7 @@ describe("UTC Storage Verification", () => {
9191
await adapter.addJob({
9292
name: "retrieval-test",
9393
payload: { test: "data" },
94-
status: "pending",
94+
status: "pending",
9595
priority: 2,
9696
attempts: 0,
9797
maxAttempts: 3,
@@ -102,20 +102,20 @@ describe("UTC Storage Verification", () => {
102102

103103
// Retrieve the job
104104
const job = await adapter.getNextJob()
105-
105+
106106
expect(job).toBeTruthy()
107107
expect(job?.processAt.toISOString()).toBe("2024-01-15T14:00:00.000Z")
108108
expect(job).not.toHaveProperty("timezone")
109109
})
110110

111111
it("should handle delayed jobs with UTC timestamps", async () => {
112112
const futureUTC = new Date(Date.now() + 3600000) // 1 hour from now in UTC
113-
113+
114114
const job = await adapter.addJob({
115115
name: "delayed-test",
116116
payload: { test: "data" },
117117
status: "delayed",
118-
priority: 2,
118+
priority: 2,
119119
attempts: 0,
120120
maxAttempts: 3,
121121
processAt: futureUTC,
@@ -135,7 +135,7 @@ describe("UTC Storage Verification", () => {
135135
payload: { test: "data" },
136136
status: "pending",
137137
priority: 2,
138-
attempts: 0,
138+
attempts: 0,
139139
maxAttempts: 3,
140140
processAt: new Date(),
141141
progress: 0,
@@ -145,13 +145,13 @@ describe("UTC Storage Verification", () => {
145145
// Verify the job object structure
146146
const jobKeys = Object.keys(job)
147147
expect(jobKeys).not.toContain("timezone")
148-
148+
149149
// Verify required UTC fields exist
150150
expect(jobKeys).toContain("createdAt")
151151
expect(jobKeys).toContain("processAt")
152-
152+
153153
// All date fields should be Date objects (UTC)
154154
expect(job.createdAt).toBeInstanceOf(Date)
155155
expect(job.processAt).toBeInstanceOf(Date)
156156
})
157-
})
157+
})

0 commit comments

Comments
 (0)