planetscale.test.cjs — drizzle-orm Source File
Architecture documentation for planetscale.test.cjs, a javascript file in the drizzle-orm codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 6883b2b3_5719_a972_9b49_5b21877b0771["planetscale.test.cjs"] 8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"] 6883b2b3_5719_a972_9b49_5b21877b0771 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686 style 6883b2b3_5719_a972_9b49_5b21877b0771 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
require('dotenv/config');
const { Client } = require('@planetscale/database');
const { drizzle } = require('drizzle-orm/planetscale-serverless');
const { mysql: schema } = require('./schema.cjs');
import { describe, expect } from 'vitest';
if (!process.env['PLANETSCALE_CONNECTION_STRING']) {
throw new Error('PLANETSCALE_CONNECTION_STRING is not defined');
}
describe('planetscale', async (it) => {
it('drizzle(string)', async () => {
const db = drizzle(
process.env['PLANETSCALE_CONNECTION_STRING'],
);
await db.$client.execute('SELECT 1;');
expect(db.$client).toBeInstanceOf(Client);
});
it('drizzle(string, config)', async () => {
const db = drizzle(
process.env['PLANETSCALE_CONNECTION_STRING'],
{
schema,
},
);
await db.$client.execute('SELECT 1;');
expect(db.$client).toBeInstanceOf(Client);
expect(db.query.User).not.toStrictEqual(undefined);
});
it('drizzle({connection: string, ...config})', async () => {
const db = drizzle({
connection: process.env['PLANETSCALE_CONNECTION_STRING'],
schema,
});
await db.$client.execute('SELECT 1;');
expect(db.$client).toBeInstanceOf(Client);
expect(db.query.User).not.toStrictEqual(undefined);
});
it('drizzle({connection: params, ...config})', async () => {
const db = drizzle({
connection: {
url: process.env['PLANETSCALE_CONNECTION_STRING'],
},
schema,
});
await db.$client.execute('SELECT 1;');
expect(db.$client).toBeInstanceOf(Client);
expect(db.query.User).not.toStrictEqual(undefined);
});
it('drizzle(client)', async () => {
const client = new Client({
url: process.env['PLANETSCALE_CONNECTION_STRING'],
});
const db = drizzle(client);
await db.$client.execute('SELECT 1;');
expect(db.$client).toBeInstanceOf(Client);
});
it('drizzle(client, config)', async () => {
const client = new Client({
url: process.env['PLANETSCALE_CONNECTION_STRING'],
});
const db = drizzle(client, {
schema,
});
await db.$client.execute('SELECT 1;');
expect(db.$client).toBeInstanceOf(Client);
expect(db.query.User).not.toStrictEqual(undefined);
});
it('drizzle({client, ...config})', async () => {
const client = new Client({
url: process.env['PLANETSCALE_CONNECTION_STRING'],
});
const db = drizzle({
client,
schema,
});
await db.$client.execute('SELECT 1;');
expect(db.$client).toBeInstanceOf(Client);
expect(db.query.User).not.toStrictEqual(undefined);
});
});
Dependencies
- vitest
Source
Frequently Asked Questions
What does planetscale.test.cjs do?
planetscale.test.cjs is a source file in the drizzle-orm codebase, written in javascript.
What does planetscale.test.cjs depend on?
planetscale.test.cjs imports 1 module(s): vitest.
Where is planetscale.test.cjs in the architecture?
planetscale.test.cjs is located at integration-tests/js-tests/driver-init/commonjs/planetscale.test.cjs (directory: integration-tests/js-tests/driver-init/commonjs).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free