@@ -5,100 +5,97 @@ import path from 'path';
55
66const expect = chai . expect ;
77
8- describe
9- . only ( 'getCloudInfo' , function ( ) {
10- beforeEach ( function ( ) {
11- nock ( 'https://raw.githubusercontent.com' , {
12- reqheaders : {
13- accept : '*/*' ,
14- 'user-agent' :
15- 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)' ,
16- 'accept-encoding' : 'gzip,deflate' ,
17- } ,
18- } )
19- . get ( '/mongodb-js/devtools-shared/main/resources/cidrs.json' )
20- . replyWithFile (
21- 200 ,
22- path . resolve ( __dirname , '../../../resources/cidrs.json' ) ,
23- ) ;
24- } ) ;
8+ describe ( 'getCloudInfo' , function ( ) {
9+ beforeEach ( function ( ) {
10+ nock ( 'https://raw.githubusercontent.com' , {
11+ reqheaders : {
12+ accept : '*/*' ,
13+ 'user-agent' : 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)' ,
14+ 'accept-encoding' : 'gzip,deflate' ,
15+ } ,
16+ } )
17+ . get ( '/mongodb-js/devtools-shared/main/resources/cidrs.json' )
18+ . replyWithFile (
19+ 200 ,
20+ path . resolve ( __dirname , '../../../resources/cidrs.json' ) ,
21+ ) ;
22+ } ) ;
2523
26- afterEach ( function ( ) {
27- nock . cleanAll ( ) ;
28- } ) ;
24+ afterEach ( function ( ) {
25+ nock . cleanAll ( ) ;
26+ } ) ;
2927
30- it ( 'returns all false for undefined' , async function ( ) {
31- const cloudInfo = await getCloudInfo ( ) ;
32- expect ( cloudInfo ) . to . deep . equal ( {
33- isAws : false ,
34- isGcp : false ,
35- isAzure : false ,
36- } ) ;
28+ it ( 'returns all false for undefined' , async function ( ) {
29+ const cloudInfo = await getCloudInfo ( ) ;
30+ expect ( cloudInfo ) . to . deep . equal ( {
31+ isAws : false ,
32+ isGcp : false ,
33+ isAzure : false ,
3734 } ) ;
35+ } ) ;
3836
39- it ( 'returns all false for localhost' , async function ( ) {
40- const cloudInfo = await getCloudInfo ( 'localhost' ) ;
41- expect ( cloudInfo ) . to . deep . equal ( {
42- isAws : false ,
43- isGcp : false ,
44- isAzure : false ,
45- } ) ;
37+ it ( 'returns all false for localhost' , async function ( ) {
38+ const cloudInfo = await getCloudInfo ( 'localhost' ) ;
39+ expect ( cloudInfo ) . to . deep . equal ( {
40+ isAws : false ,
41+ isGcp : false ,
42+ isAzure : false ,
4643 } ) ;
44+ } ) ;
4745
48- it ( 'works with local ip address (127.0.0.1)' , async function ( ) {
49- const cloudInfo = await getCloudInfo ( '127.0.0.1' ) ;
50- expect ( cloudInfo ) . to . deep . equal ( {
51- isAws : false ,
52- isGcp : false ,
53- isAzure : false ,
54- } ) ;
46+ it ( 'works with local ip address (127.0.0.1)' , async function ( ) {
47+ const cloudInfo = await getCloudInfo ( '127.0.0.1' ) ;
48+ expect ( cloudInfo ) . to . deep . equal ( {
49+ isAws : false ,
50+ isGcp : false ,
51+ isAzure : false ,
5552 } ) ;
53+ } ) ;
5654
57- it ( 'works with local ipv6 address (::1)' , async function ( ) {
58- const cloudInfo = await getCloudInfo ( '::1' ) ;
59- expect ( cloudInfo ) . to . deep . equal ( {
60- isAws : false ,
61- isGcp : false ,
62- isAzure : false ,
63- } ) ;
55+ it ( 'works with local ipv6 address (::1)' , async function ( ) {
56+ const cloudInfo = await getCloudInfo ( '::1' ) ;
57+ expect ( cloudInfo ) . to . deep . equal ( {
58+ isAws : false ,
59+ isGcp : false ,
60+ isAzure : false ,
6461 } ) ;
62+ } ) ;
6563
66- it ( 'returns {isAws: true} if hostname is an AWS ip' , async function ( ) {
67- const cloudInfo = await getCloudInfo ( '13.248.118.1' ) ;
68- expect ( cloudInfo ) . to . deep . equal ( {
69- isAws : true ,
70- isGcp : false ,
71- isAzure : false ,
72- } ) ;
64+ it ( 'returns {isAws: true} if hostname is an AWS ip' , async function ( ) {
65+ const cloudInfo = await getCloudInfo ( '13.248.118.1' ) ;
66+ expect ( cloudInfo ) . to . deep . equal ( {
67+ isAws : true ,
68+ isGcp : false ,
69+ isAzure : false ,
7370 } ) ;
71+ } ) ;
7472
75- it ( 'returns {isGcp: true} if hostname is a GCP ip' , async function ( ) {
76- const cloudInfo = await getCloudInfo ( '8.34.208.1' ) ;
77- expect ( cloudInfo ) . to . deep . equal ( {
78- isAws : false ,
79- isGcp : true ,
80- isAzure : false ,
81- } ) ;
73+ it ( 'returns {isGcp: true} if hostname is a GCP ip' , async function ( ) {
74+ const cloudInfo = await getCloudInfo ( '8.34.208.1' ) ;
75+ expect ( cloudInfo ) . to . deep . equal ( {
76+ isAws : false ,
77+ isGcp : true ,
78+ isAzure : false ,
8279 } ) ;
80+ } ) ;
8381
84- it ( 'returns {isAzure: true} if hostname is an Azure ip' , async function ( ) {
85- const cloudInfo = await getCloudInfo ( '13.64.151.161' ) ;
86- expect ( cloudInfo ) . to . deep . equal ( {
87- isAws : false ,
88- isGcp : false ,
89- isAzure : true ,
90- } ) ;
82+ it ( 'returns {isAzure: true} if hostname is an Azure ip' , async function ( ) {
83+ const cloudInfo = await getCloudInfo ( '13.64.151.161' ) ;
84+ expect ( cloudInfo ) . to . deep . equal ( {
85+ isAws : false ,
86+ isGcp : false ,
87+ isAzure : true ,
9188 } ) ;
89+ } ) ;
9290
93- it ( 'returns {isAws: true} if CNAME resolves to an AWS host' , async function ( ) {
94- const cloudInfo = await getCloudInfo (
95- 'compass-data-sets-shard-00-00.e06dc.mongodb.net' ,
96- ) ;
97- expect ( cloudInfo ) . to . deep . equal ( {
98- isAws : true ,
99- isGcp : false ,
100- isAzure : false ,
101- } ) ;
91+ it ( 'returns {isAws: true} if CNAME resolves to an AWS host' , async function ( ) {
92+ const cloudInfo = await getCloudInfo (
93+ 'compass-data-sets-shard-00-00.e06dc.mongodb.net' ,
94+ ) ;
95+ expect ( cloudInfo ) . to . deep . equal ( {
96+ isAws : true ,
97+ isGcp : false ,
98+ isAzure : false ,
10299 } ) ;
103- } )
104- . timeout ( 5000 ) ;
100+ } ) ;
101+ } ) . timeout ( 5000 ) ;
0 commit comments