File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1- import { collections } from "$lib/server/database" ;
1+ import { getCollectionsEarly } from "$lib/server/database" ;
22import { ObjectId } from "mongodb" ;
33import { describe , expect , it } from "vitest" ;
44
55// function used to insert conversations used for testing
6+ const getConversations = async ( ) => ( await getCollectionsEarly ( ) ) . conversations ;
67
78export const insertLegacyConversation = async ( ) => {
8- const res = await collections . conversations . insertOne ( {
9+ const conversations = await getConversations ( ) ;
10+ const res = await conversations . insertOne ( {
911 _id : new ObjectId ( ) ,
1012 createdAt : new Date ( ) ,
1113 updatedAt : new Date ( ) ,
@@ -39,7 +41,8 @@ export const insertLegacyConversation = async () => {
3941} ;
4042
4143export const insertLinearBranchConversation = async ( ) => {
42- const res = await collections . conversations . insertOne ( {
44+ const conversations = await getConversations ( ) ;
45+ const res = await conversations . insertOne ( {
4346 _id : new ObjectId ( ) ,
4447 createdAt : new Date ( ) ,
4548 updatedAt : new Date ( ) ,
@@ -82,7 +85,8 @@ export const insertLinearBranchConversation = async () => {
8285} ;
8386
8487export const insertSideBranchesConversation = async ( ) => {
85- const res = await collections . conversations . insertOne ( {
88+ const conversations = await getConversations ( ) ;
89+ const res = await conversations . insertOne ( {
8690 _id : new ObjectId ( ) ,
8791 createdAt : new Date ( ) ,
8892 updatedAt : new Date ( ) ,
You can’t perform that action at this time.
0 commit comments