FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-inspector/test/ScriptManager.js at master · yogeshpowar/node-inspector · GitHub
yogeshpowar
/
node-inspector
Public
forked from
node-inspector/node-inspector
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node-inspector
/
test
/
ScriptManager.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
92 lines (81 loc) · 2.84 KB
Breadcrumbs
node-inspector
/
test
/
ScriptManager.js
Copy path
File metadata and controls
92 lines (81 loc) · 2.84 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
var
expect
=
require
(
'chai'
)
.
expect
,
path
=
require
(
'path'
)
,
SessionStub
=
require
(
'./helpers/SessionStub.js'
)
,
ScriptManager
=
require
(
'../lib/ScriptManager'
)
.
ScriptManager
;
describe
(
'ScriptManager'
,
function
(
)
{
var
manager
;
var
realMainAppScript
=
'folder'
+
path
.
sep
+
'App.js'
;
var
mainAppScript
=
'folder'
+
path
.
sep
+
'app.js'
;
beforeEach
(
function
(
)
{
manager
=
new
ScriptManager
(
{
}
,
new
SessionStub
(
)
)
;
manager
.
realMainAppScript
=
realMainAppScript
;
manager
.
mainAppScript
=
mainAppScript
;
}
)
;
describe
(
'findSourceByID()'
,
function
(
)
{
it
(
'returns stored source'
,
function
(
)
{
manager
.
_sources
[
'id'
]
=
'a-source'
;
expect
(
manager
.
findScriptByID
(
'id'
)
)
.
to
.
equal
(
'a-source'
)
;
}
)
;
it
(
'returns undefined for unknown id'
,
function
(
)
{
expect
(
manager
.
findScriptByID
(
'unknown-id'
)
)
.
to
.
equal
(
undefined
)
;
}
)
;
}
)
;
describe
(
'resolveScriptById()'
,
function
(
)
{
it
(
'returns stored source'
,
function
(
done
)
{
manager
.
_sources
[
'id'
]
=
'a-source'
;
manager
.
resolveScriptById
(
'id'
,
function
(
err
,
result
)
{
expect
(
err
)
.
to
.
equal
(
null
)
;
expect
(
result
)
.
to
.
equal
(
'a-source'
)
;
done
(
)
;
}
)
;
}
)
;
it
(
'requires script from app for unknown id'
,
function
(
done
)
{
manager
.
_debuggerClient
.
request
=
function
(
command
,
attributes
,
cb
)
{
if
(
command
==
'scripts'
&&
attributes
.
filter
==
'unknown-id'
)
{
cb
(
null
,
[
{
id
:
3
,
name
:
'required-id'
,
lineOffset
:
1
,
columnOffset
:
1
}
]
)
;
}
}
;
manager
.
resolveScriptById
(
'unknown-id'
,
function
(
err
,
result
)
{
expect
(
err
)
.
to
.
equal
(
null
)
;
expect
(
result
)
.
to
.
deep
.
equal
(
{
scriptId
:
'3'
,
url
:
'required-id'
,
startLine
:
1
,
startColumn
:
1
}
)
;
done
(
)
;
}
)
;
}
)
;
}
)
;
describe
(
'reset()'
,
function
(
)
{
it
(
'removes all stored scripts'
,
function
(
)
{
manager
.
_sources
[
'id'
]
=
'a-source'
;
manager
.
reset
(
)
;
expect
(
manager
.
findScriptByID
(
'id'
)
)
.
to
.
equal
(
undefined
)
;
}
)
;
}
)
;
describe
(
'normalizeName()'
,
function
(
)
{
if
(
process
.
platform
==
'win32'
)
{
it
(
'returns case sensitive name for main script on Windows'
,
function
(
)
{
var
name
=
manager
.
normalizeName
(
realMainAppScript
)
;
expect
(
name
)
.
to
.
equal
(
mainAppScript
)
;
}
)
;
}
else
{
it
(
'returns unchanged name for main script on Linux'
,
function
(
)
{
var
name
=
manager
.
normalizeName
(
'folder/app.js'
)
;
var
normalized_name
=
manager
.
normalizeName
(
realMainAppScript
)
;
expect
(
normalized_name
)
.
to
.
equal
(
realMainAppScript
)
;
}
)
;
}
it
(
'returns unchanged name for not main scripts'
,
function
(
)
{
var
name
=
'folder/app1.js'
;
var
normalized_name
=
manager
.
normalizeName
(
name
)
;
expect
(
normalized_name
)
.
to
.
equal
(
name
)
;
}
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL