0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-03 22:29:08 -05:00

chore: expose setMeta for unit testing

This commit is contained in:
bholmesdev 2024-02-06 16:53:39 -05:00
parent 452a3c8581
commit aa00edea81

View file

@ -114,7 +114,9 @@ function astroDBIntegration(): AstroIntegration {
}, 100);
},
'astro:build:start': async ({ logger }) => {
logger.info('database: ' + (connectedToRemote ? yellow('remote') : blue('local database.')));
logger.info(
'database: ' + (connectedToRemote ? yellow('remote') : blue('local database.'))
);
},
'astro:build:done': async ({ }) => {
await appToken?.destroy();
@ -127,8 +129,10 @@ function astroDBIntegration(): AstroIntegration {
* We need to attach the Drizzle `table` and collection name at runtime.
* These cannot be determined from `defineCollection()`,
* since we don't know the collection name until the `db` config is resolved.
*
* exported for unit testing.
*/
function setCollectionsMeta(collections: Record<string, any>) {
export function setCollectionsMeta(collections: Record<string, any>) {
for (const [name, collection] of Object.entries(collections)) {
const table = collectionToTable(name, collection);
collection._setMeta?.({ table });