66 getPromiseProperties
77} = require ( "../object-inspector" ) ;
88
9+ const root = {
10+ path : "root" ,
11+ contents : { value : { } }
12+ } ;
13+
914const objProperties = {
1015 ownProperties : {
1116 "0" : {
@@ -26,13 +31,14 @@ const objProperties = {
2631describe ( "object-inspector" , ( ) => {
2732 describe ( "makeNodesForProperties" , ( ) => {
2833 it ( "kitchen sink" , ( ) => {
29- const nodes = makeNodesForProperties ( objProperties , "root" ) ;
34+ // console.log(this.root);
35+ const nodes = makeNodesForProperties ( objProperties , root ) ;
3036
3137 const names = nodes . map ( n => n . name ) ;
32- expect ( names ) . to . eql ( [ "0" , "[default properties] " , "__proto__" ] ) ;
38+ expect ( names ) . to . eql ( [ "0" , "length " , "__proto__" ] ) ;
3339
3440 const paths = nodes . map ( n => n . path ) ;
35- expect ( paths ) . to . eql ( [ "root/0" , "root/default " , "root/__proto__" ] ) ;
41+ expect ( paths ) . to . eql ( [ "root/0" , "root/length " , "root/__proto__" ] ) ;
3642 } ) ;
3743
3844 it ( "excludes getters" , ( ) => {
@@ -46,7 +52,7 @@ describe("object-inspector", () => {
4652 class : "bla"
4753 }
4854 } ,
49- " root"
55+ root
5056 ) ;
5157
5258 const names = nodes . map ( n => n . name ) ;
@@ -70,7 +76,7 @@ describe("object-inspector", () => {
7076 class : "bla"
7177 }
7278 } ,
73- " root"
79+ root
7480 ) ;
7581
7682 const names = nodes . map ( n => n . name ) ;
@@ -95,7 +101,7 @@ describe("object-inspector", () => {
95101 } ,
96102 prototype : { value : { } , class : "bla" }
97103 } ,
98- " root"
104+ root
99105 ) ;
100106
101107 const names = nodes . map ( n => n . name ) ;
@@ -105,13 +111,35 @@ describe("object-inspector", () => {
105111 expect ( paths ) . to . eql ( [ "root/bar" , "root/__proto__" ] ) ;
106112 } ) ;
107113
114+ it ( "window object" , ( ) => {
115+ const nodes = makeNodesForProperties (
116+ {
117+ ownProperties : {
118+ bar : { value : { } } ,
119+ location : { value : { } }
120+ } ,
121+ class : "Window"
122+ } ,
123+ {
124+ path : "root" ,
125+ contents : { value : { class : "Window" } }
126+ }
127+ ) ;
128+
129+ const names = nodes . map ( n => n . name ) ;
130+ const paths = nodes . map ( n => n . path ) ;
131+
132+ expect ( names ) . to . eql ( [ "bar" , "[default properties]" ] ) ;
133+ expect ( paths ) . to . eql ( [ "root/bar" , "root/##-default" ] ) ;
134+ } ) ;
135+
108136 // For large arrays
109137 it ( "numerical buckets" , ( ) => {
110138 let objProps = { ownProperties : { } , prototype : { class : "Array" } } ;
111139 for ( let i = 0 ; i < 331 ; i ++ ) {
112140 objProps . ownProperties [ i ] = { value : { } } ;
113141 }
114- const nodes = makeNodesForProperties ( objProps , " root" ) ;
142+ const nodes = makeNodesForProperties ( objProps , root ) ;
115143
116144 const names = nodes . map ( n => n . name ) ;
117145 const paths = nodes . map ( n => n . path ) ;
@@ -147,7 +175,7 @@ describe("object-inspector", () => {
147175 class : "WindowPrototype"
148176 }
149177 } ,
150- " root"
178+ root
151179 ) ;
152180
153181 const names = nodes . map ( n => n . name ) ;
0 commit comments