MCPcopy
hub / github.com/mongodb/node-mongodb-native / makeStub

Function makeStub

test/unit/connection_string.test.ts:626–648  ·  view source on GitHub ↗
(txtRecord: string)

Source from the content-addressed store, hash-verified

624 });
625
626 function makeStub(txtRecord: string) {
627 const mockAddress = [
628 {
629 name: 'localhost.test.mock.test.build.10gen.cc',
630 port: 2017,
631 weight: 0,
632 priority: 0
633 }
634 ];
635
636 const mockRecord: string[][] = [[txtRecord]];
637
638 // first call is for stubbing resolve
639 // second call is for stubbing resolve
640 const stub = sinon.stub(dns.promises, 'resolve');
641 stub.withArgs(sinon.match.any, 'SRV').callsFake(async () => {
642 return mockAddress;
643 });
644
645 stub.withArgs(sinon.match.any, 'TXT').callsFake(async () => {
646 return mockRecord;
647 });
648 }
649
650 for (const mechanism of AUTH_MECHS_AUTH_SRC_EXTERNAL) {
651 it(`should set authSource to $external for ${mechanism} external mechanism`, async function () {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected