diff --git a/adapter.memory.test.ts b/adapter.memory.test.ts new file mode 100644 index 0000000..af0582f --- /dev/null +++ b/adapter.memory.test.ts @@ -0,0 +1,22 @@ +import mongo from './mod.ts' + +import { suite } from './test/suite.ts' + +Deno.test({ + name: 'Mongo Adapter Test Suite - In-Memory', + fn: async (t) => { + const { client } = await mongo({ dir: '__hyper__', dirVersion: '7.0.4' }).load() + await suite(t)(client, { shouldBaseLine: true }) + }, + /** + * The native client maintains TCP connections + * and timers, as part of connecting to Mongo, + * + * So we ignore sanitization of these resources + * and ops, when running tests with the NativeClient + * + * See https://deno.com/manual/basics/testing/sanitizers + */ + sanitizeOps: false, + sanitizeResources: false, +}) diff --git a/adapter.native.integration.test.ts b/adapter.native.integration.test.ts index 6ba6678..8125790 100644 --- a/adapter.native.integration.test.ts +++ b/adapter.native.integration.test.ts @@ -1,4 +1,4 @@ -import { NativeClient } from './clients/native.ts' +import mongo from './mod.ts' import { suite } from './test/suite.ts' @@ -10,7 +10,7 @@ Deno.test({ throw new Error('MongoDB connection string is required at MONGO_URL') } - const client = new NativeClient({ url }) + const { client } = await mongo({ url }).load() await suite(t)(client, { shouldBaseLine: true }) }, /** diff --git a/mod.ts b/mod.ts index e907b90..89d6e5d 100644 --- a/mod.ts +++ b/mod.ts @@ -34,7 +34,6 @@ export default (config: AdapterConfig) => ({ instance: { dbPath: join(mongoMsDir, 'data'), storageEngine: 'wiredTiger' }, binary: { downloadDir: mongoMsDir, version: config.dirVersion }, }).then((mongod) => new URL(mongod.getUri())) - console.log(`In-Memory MongoDB: ${url.toString()}`) } else { url = new URL(config.url as string) }