Skip to content

Commit 96c0fca

Browse files
committed
03/03: drop contractions
1 parent 9e8ee0f commit 96c0fca

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

exercises/03.context/02.solution.automatic-fixtures/test-extend.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ function toPromise<T>(init: (handle: CallbackHandle) => T): Promise<T> {
2626
export const test = testBase.extend<Fixtures>({
2727
createMockDatabase: [
2828
async ({ task, onTestFinished }, use) => {
29-
const dbFile = `${task.file.filepath}-${task.id}.sqlite`
29+
const databasePath = `${task.file.filepath}-${task.id}.sqlite`
3030

31-
if (fs.existsSync(dbFile)) {
32-
await fs.promises.rm(dbFile)
31+
if (fs.existsSync(databasePath)) {
32+
await fs.promises.rm(databasePath)
3333
}
3434

3535
const mockDatabase = await toPromise((handle) => {
36-
return new sqlite3.Database(dbFile, handle)
36+
return new sqlite3.Database(databasePath, handle)
3737
})
3838

3939
onTestFinished(async ({ task }) => {
@@ -44,12 +44,12 @@ export const test = testBase.extend<Fixtures>({
4444
}
4545

4646
if (task.result?.state === 'pass') {
47-
await fs.promises.rm(dbFile)
47+
await fs.promises.rm(databasePath)
4848
} else {
4949
task.result?.errors?.push({
5050
name: 'Mock database',
5151
message: 'See the database state:',
52-
codeFrame: path.relative(process.cwd(), dbFile),
52+
codeFrame: path.relative(process.cwd(), databasePath),
5353
})
5454
}
5555
})

exercises/03.context/03.solution.global-context/test-extend.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ function toPromise<T>(init: (handle: CallbackHandle) => T): Promise<T> {
3434
globalThis.test = testBase.extend<Fixtures>({
3535
createMockDatabase: [
3636
async ({ task, onTestFinished }, use) => {
37-
const dbFile = `${task.file.filepath}-${task.id}.sqlite`
37+
const databasePath = `${task.file.filepath}-${task.id}.sqlite`
3838

39-
if (fs.existsSync(dbFile)) {
40-
await fs.promises.rm(dbFile)
39+
if (fs.existsSync(databasePath)) {
40+
await fs.promises.rm(databasePath)
4141
}
4242

4343
const mockDatabase = await toPromise((handle) => {
44-
return new sqlite3.Database(dbFile, handle)
44+
return new sqlite3.Database(databasePath, handle)
4545
})
4646

4747
onTestFinished(async ({ task }) => {
@@ -52,12 +52,12 @@ globalThis.test = testBase.extend<Fixtures>({
5252
}
5353

5454
if (task.result?.state === 'pass') {
55-
await fs.promises.rm(dbFile)
55+
await fs.promises.rm(databasePath)
5656
} else {
5757
task.result?.errors?.push({
5858
name: 'Mock database',
5959
message: 'See the database state:',
60-
codeFrame: path.relative(process.cwd(), dbFile),
60+
codeFrame: path.relative(process.cwd(), databasePath),
6161
})
6262
}
6363
})

0 commit comments

Comments
 (0)