Skip to content

Commit 64dc781

Browse files
committed
test(utils): add test for "getHost"
1 parent b05ec44 commit 64dc781

File tree

1 file changed

+10
-0
lines changed
  • packages/mongodb-memory-server-core/src/util/__tests__

1 file changed

+10
-0
lines changed

packages/mongodb-memory-server-core/src/util/__tests__/utils.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,14 @@ describe('utils', () => {
107107
).rejects.toThrow(retError);
108108
});
109109
});
110+
111+
describe('getHost', () => {
112+
it('should correctly extract host & port', () => {
113+
expect(utils.getHost('mongodb://user:pass@localhost:port/authdb?queryoptions=1')).toEqual(
114+
'localhost:port'
115+
);
116+
expect(utils.getHost('mongodb://0.0.0.0:0000/')).toEqual('0.0.0.0:0000');
117+
expect(utils.getHost('mongodb://user:pass@localhost:0000/')).toEqual('localhost:0000');
118+
});
119+
});
110120
});

0 commit comments

Comments
 (0)