FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
leetcode-cli/test/test_config.js at master · lebeier/leetcode-cli · GitHub
lebeier
leetcode-cli
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
leetcode-cli
/
test
/
test_config.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (51 loc) · 1.51 KB
Breadcrumbs
leetcode-cli
/
test
/
test_config.js
Copy path
File metadata and controls
64 lines (51 loc) · 1.51 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
'use strict'
;
const
assert
=
require
(
'chai'
)
.
assert
;
const
rewire
=
require
(
'rewire'
)
;
const
_
=
require
(
'underscore'
)
;
const
th
=
require
(
'./helper'
)
;
describe
(
'config'
,
function
(
)
{
let
config
;
const
FILE
=
'./tmp/config.json'
;
beforeEach
(
function
(
)
{
th
.
clean
(
)
;
const
file
=
rewire
(
'../lib/file'
)
;
file
.
configFile
=
(
)
=>
FILE
;
config
=
rewire
(
'../lib/config'
)
;
config
.
__set__
(
'file'
,
file
)
;
}
)
;
function
createConfigFile
(
data
)
{
const
fs
=
require
(
'fs'
)
;
fs
.
writeFileSync
(
FILE
,
JSON
.
stringify
(
data
)
)
;
}
it
(
'should ok w/o local config'
,
function
(
)
{
const
DEFAULT_CONFIG
=
config
.
__get__
(
'DEFAULT_CONFIG'
)
;
config
.
init
(
)
;
let
actual
=
config
.
getAll
(
)
;
let
expect
=
DEFAULT_CONFIG
;
assert
.
deepEqual
(
actual
,
expect
)
;
actual
=
config
.
getAll
(
true
)
;
expect
=
_
.
omit
(
expect
,
'sys'
)
;
assert
.
deepEqual
(
actual
,
expect
)
;
}
)
;
it
(
'should ok w/ local config'
,
function
(
)
{
createConfigFile
(
{
autologin
:
{
enable
:
false
}
,
code
:
{
lang
:
'ruby'
}
,
color
:
{
enable
:
false
}
}
)
;
config
.
init
(
)
;
assert
.
equal
(
config
.
autologin
.
enable
,
false
)
;
assert
.
equal
(
config
.
code
.
lang
,
'ruby'
)
;
assert
.
equal
(
config
.
color
.
enable
,
false
)
;
assert
.
equal
(
config
.
code
.
editor
,
'vim'
)
;
}
)
;
it
(
'should remove legacy keys'
,
function
(
)
{
createConfigFile
(
{
USE_COLOR
:
true
,
code
:
{
lang
:
'ruby'
}
}
)
;
config
.
init
(
)
;
assert
.
equal
(
config
.
USE_COLOR
,
undefined
)
;
assert
.
equal
(
config
.
code
.
lang
,
'ruby'
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL