-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
386 additions
and
607 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
tabWidth: 2 | ||
semi: false | ||
printWidth: 120 | ||
trailingComma: es5 | ||
trailingComma: all | ||
singleQuote: true |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
import { testCallResolver } from '../../util/testResolver'; | ||
import { GREETING } from './greeting'; | ||
|
||
const { getGreeting, greetInner } = await import('./greeting'); | ||
import { testCallResolver } from '../../util/testResolver' | ||
import { getGreeting, GREETING, greetInner } from './greeting' | ||
|
||
describe('Greeting resolvers', () => { | ||
it('gets current greeting', async () => { | ||
const greeting = await testCallResolver({ | ||
args: {}, | ||
resolverFunc: getGreeting, | ||
}); | ||
expect(greeting.currentGreeting).toBe(GREETING); | ||
}); | ||
const greeting = getGreeting() | ||
expect(greeting.currentGreeting).toBe(GREETING) | ||
}) | ||
|
||
it('greets user by name', async () => { | ||
const greeting = await testCallResolver({ | ||
userName: 'cognitoUsername', | ||
args: { name: 'Lebowski' }, | ||
resolverFunc: greetInner, | ||
}); | ||
expect(greeting.greeting).toBe(`${GREETING}, Lebowski!`); | ||
}); | ||
}); | ||
}) | ||
expect(greeting.greeting).toBe(`${GREETING}, Lebowski!`) | ||
}) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import { truncateAllTables } from '@backend/db/seed/truncate'; | ||
import { userFactory } from '@backend/db/factory/user'; | ||
import { Prisma } from '@prisma/client'; | ||
import { truncateAllTables } from '@backend/db/seed/truncate' | ||
import { userFactory } from '@backend/db/factory/user' | ||
import { Prisma } from '@prisma/client' | ||
|
||
const { prisma } = await import('@backend/db/clientSync'); | ||
const { prisma } = await import('@backend/db/clientSync') | ||
|
||
export async function seedFakerSampleData() { | ||
prisma.$transaction(startSeeding, { maxWait: 30_000, timeout: 60_000 }); | ||
await prisma.$transaction(startSeeding, { maxWait: 30_000, timeout: 60_000 }) | ||
} | ||
|
||
export async function startSeeding(prisma: Prisma.TransactionClient) { | ||
if (process.env.CLEAN_SEED) { | ||
// Remove old data | ||
truncateAllTables(prisma); | ||
await truncateAllTables(prisma) | ||
} | ||
|
||
// Create 5 fake users with generated data | ||
await prisma.user.createMany({ data: userFactory.buildList(5) }); | ||
await prisma.user.createMany({ data: userFactory.buildList(5) }) | ||
// Create 1 user with some custom data | ||
await prisma.user.create({ | ||
data: userFactory.build({ | ||
name: 'Robert Lewandowski', | ||
email: 'lewa@fcbarcelona.com', | ||
}), | ||
}); | ||
}) | ||
} |
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
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
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
Oops, something went wrong.