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

Method setup

test/tools/common.js:18–46  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

16 }
17
18 setup(options) {
19 options = options || {};
20 const hello = options[LEGACY_HELLO_COMMAND] ? options[LEGACY_HELLO_COMMAND] : mock.HELLO;
21
22 return Promise.all([
23 mock.createServer(),
24 mock.createServer(),
25 mock.createServer(),
26 mock.createServer()
27 ]).then(servers => {
28 this.servers = servers;
29 this.primaryServer = servers[0];
30 this.firstSecondaryServer = servers[1];
31 this.secondSecondaryServer = servers[2];
32 this.arbiterServer = servers[3];
33
34 this.defaultFields = Object.assign({}, hello, {
35 __nodejs_mock_server__: true,
36 setName: 'rs',
37 setVersion: 1,
38 electionId: this.electionIds[0],
39 hosts: this.servers.map(server => server.uri()),
40 arbiters: [this.arbiterServer.uri()]
41 });
42
43 if (!options.doNotInitStates) this.defineReplSetStates();
44 if (!options.doNotInitHandlers) this.configureMessageHandlers();
45 });
46 }
47
48 defineReplSetStates() {
49 this.primaryStates = [

Callers 6

sessions.test.tsFile · 0.45
error.test.tsFile · 0.45
eFunction · 0.45

Calls 4

defineReplSetStatesMethod · 0.95
mapMethod · 0.45
uriMethod · 0.45

Tested by

no test coverage detected