softgrip
softgrip
DTDrizzle Team
Created by softgrip on 9/2/2023 in #help
In memory tests with libsql?
Do you guys know if there's a way to get this working with libsql? I'm using turso, and was hoping to get the DB working in memory for local tests. I have this
import { describe, it, expect, beforeAll } from 'vitest';

import { db } from '$lib/server/db';
import * as userService from '$lib/server/users/service';
import { migrate } from 'drizzle-orm/libsql/migrator';
import { userTable } from '$lib/server/users/schema';

describe('userService test', () => {
beforeAll(async () => {
await migrate(db, { migrationsFolder: 'drizzle' });
});

it('allUsers', async () => {
await userService.allUsers();
});

it('deleteUser', async () => {
await userService.deleteUser('123');
});

it('addUser', async () => {
await userService.addUser({ name: 'test', email: '[email protected]' });
});
});
import { describe, it, expect, beforeAll } from 'vitest';

import { db } from '$lib/server/db';
import * as userService from '$lib/server/users/service';
import { migrate } from 'drizzle-orm/libsql/migrator';
import { userTable } from '$lib/server/users/schema';

describe('userService test', () => {
beforeAll(async () => {
await migrate(db, { migrationsFolder: 'drizzle' });
});

it('allUsers', async () => {
await userService.allUsers();
});

it('deleteUser', async () => {
await userService.deleteUser('123');
});

it('addUser', async () => {
await userService.addUser({ name: 'test', email: '[email protected]' });
});
});
I'm just setting the DATABASE_URL in env and passing that through. I'm basically doing the same thing as mentioned here https://discord.com/channels/1043890932593987624/1137482695862132745/1138184887048867850 however I'm using libsql
4 replies