Skip to content

Commit

Permalink
fix: migration diff step n tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tericcabrel committed Sep 1, 2024
1 parent 89c7efc commit 977e698
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/migration-db-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
echo "The following migration will be applied to the production database:" > migration-message.txt
echo "" >> migration-message.txt
echo "\`\`\`sql" >> migration-message.txt
echo "prisma migrate diff --from-url "$PROD_DATABASE_URL" --to-url "$DATABASE_URL" --script" >> migration-message.txt
yarn prisma migrate diff --from-url "$PROD_DATABASE_URL" --to-url "$DATABASE_URL" --script >> migration-message.txt
echo "\`\`\`" >> migration-message.txt
echo "" >> migration-message.txt
echo "" >> migration-message.txt
Expand Down
2 changes: 0 additions & 2 deletions packages/domain/src/services/folders/folder.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ describe('Test Folder service', () => {
let testHelper: TestHelper;

beforeAll(async () => {
console.log('Environment Variables:', process.env);

const module: TestingModule = await Test.createTestingModule({
imports: [
DomainModule.forRootAsync({
Expand Down
18 changes: 9 additions & 9 deletions packages/domain/src/services/sessions/session.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe('Test Session Service', function () {
});

test('Create a session', async () => {
const userId = TestHelper.generateTestId();
const input = TestHelper.createTestSessionInput(userId);
const user = await testHelper.createTestUser({});
const input = TestHelper.createTestSessionInput(user.id);

const sessionCreated = await sessionService.create(input);

Expand All @@ -46,8 +46,8 @@ describe('Test Session Service', function () {
});

test('Retrieve a session by the token attached to it', async () => {
const userId = TestHelper.generateTestId();
const session = await testHelper.createTestSession({ userId });
const user = await testHelper.createTestUser({});
const session = await testHelper.createTestSession({ userId: user.id });

const sessionFound = await sessionService.findByToken(session.token);

Expand All @@ -57,15 +57,15 @@ describe('Test Session Service', function () {
});

test('Delete all sessions of a user', async () => {
const userId = TestHelper.generateTestId();
const user = await testHelper.createTestUser({});

const sessionsCreated = await Promise.all([
testHelper.createTestSession({ userId }),
testHelper.createTestSession({ userId }),
testHelper.createTestSession({ userId }),
testHelper.createTestSession({ userId: user.id }),
testHelper.createTestSession({ userId: user.id }),
testHelper.createTestSession({ userId: user.id }),
]);

await sessionService.deleteUserSessions(userId);
await sessionService.deleteUserSessions(user.id);

const userSessions = await Promise.all(sessionsCreated.map(({ token }) => sessionService.findByToken(token)));

Expand Down

0 comments on commit 977e698

Please sign in to comment.