FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
unfetch/test/polyfill.test.js at main · developit/unfetch · GitHub
developit
unfetch
Repository navigation
Code
Issues
20
(20)
Pull requests
10
(10)
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
unfetch
/
test
/
polyfill.test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (28 loc) · 872 Bytes
Breadcrumbs
unfetch
/
test
/
polyfill.test.js
Copy path
File metadata and controls
30 lines (28 loc) · 872 Bytes
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
import
vm
from
"vm"
;
import
fs
from
"fs"
;
describe
(
"unfetch/polyfill"
,
(
)
=>
{
it
(
"should resolve to fetch when window.fetch exists"
,
(
)
=>
{
function
fetch
(
)
{
}
let
window
=
{
fetch
,
require
}
;
window
.
window
=
window
.
global
=
window
.
self
=
window
;
let
filename
=
require
.
resolve
(
"../polyfill/index.js"
)
;
vm
.
runInNewContext
(
fs
.
readFileSync
(
filename
,
"utf8"
)
,
window
,
"polyfill-test.js"
)
;
expect
(
window
.
fetch
)
.
toBe
(
fetch
)
;
}
)
;
it
(
"should resolve to unfetch when window.fetch does not exist"
,
(
)
=>
{
let
window
=
{
require
}
;
window
.
window
=
window
.
global
=
window
.
self
=
window
;
let
filename
=
require
.
resolve
(
"../polyfill/index.js"
)
;
vm
.
runInNewContext
(
fs
.
readFileSync
(
filename
,
"utf8"
)
,
window
,
"polyfill-test.js"
)
;
expect
(
window
.
fetch
)
.
toEqual
(
expect
.
any
(
Function
)
)
;
expect
(
window
.
fetch
)
.
toHaveLength
(
2
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL