ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / terminal-suggest / src / fig / shared / test / utils.test.ts 144 строк · изменён 14 нояб., 04:52
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import { deepStrictEqual, ok } from 'node:assert' ;
import {
makeArray,
makeArrayIfExists,
longestCommonPrefix,
compareNamedObjectsAlphabetically,
fieldsAreEqual,
} from '../utils' ;
function expect < T > ( a: T ) : { toEqual : ( b: T ) => void } {
return {
toEqual : ( b: T )
a b
a
b
c
d
e fn
f fa fb fba
g
a
b
c
d
e fn
f fa fb fba
g
a a
a a
a a
a a
a b c
a b c
a b
name name
name name
name name
name name
=>
{
deepStrictEqual
(
,
)
;
}
}
;
}
suite
(
'fig/shared/ fieldsAreEqual'
,
(
)
=>
{
test
(
'should return immediately if two values are the same'
,
(
)
=>
{
expect
(
fieldsAreEqual
(
'hello'
,
'hello'
,
[
]
)
)
.
toEqual
(
true
)
;
expect
(
fieldsAreEqual
(
'hello'
,
'hell'
,
[
]
)
)
.
toEqual
(
false
)
;
expect
(
fieldsAreEqual
(
1
,
1
,
[
'valueOf'
]
)
)
.
toEqual
(
true
)
;
expect
(
fieldsAreEqual
(
null
,
null
,
[
]
)
)
.
toEqual
(
true
)
;
expect
(
fieldsAreEqual
(
null
,
undefined
,
[
]
)
)
.
toEqual
(
false
)
;
expect
(
fieldsAreEqual
(
undefined
,
undefined
,
[
]
)
)
.
toEqual
(
true
)
;
expect
(
fieldsAreEqual
(
null
,
'hello'
,
[
]
)
)
.
toEqual
(
false
)
;
expect
(
fieldsAreEqual
(
100
,
null
,
[
]
)
)
.
toEqual
(
false
)
;
expect
(
fieldsAreEqual
(
{
}
,
{
}
,
[
]
)
)
.
toEqual
(
true
)
;
expect
(
fieldsAreEqual
(
(
)
=>
{
}
,
(
)
=>
{
}
,
[
]
,
)
,
)
.
toEqual
(
false
)
;
}
)
;
test
(
'should return true if fields are equal'
,
(
)
=>
{
const
fn
=
(
)
=>
{
}
;
expect
(
fieldsAreEqual
(
{
:
'hello'
,
:
100
,
:
undefined
,
:
false
,
:
,
:
{
:
true
,
:
{
:
true
}
}
,
:
null
,
}
,
{
:
'hello'
,
:
100
,
:
undefined
,
:
false
,
:
,
:
{
:
true
,
:
{
:
true
}
}
,
:
null
,
}
,
[
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
]
,
)
,
)
.
toEqual
(
true
)
;
expect
(
fieldsAreEqual
(
{
:
{
}
}
,
{
:
{
}
}
,
[
'a'
]
)
)
.
toEqual
(
true
)
;
}
)
;
test
(
'should return false if any field is not equal or fields are not specified'
,
(
)
=>
{
expect
(
fieldsAreEqual
(
{
:
null
}
,
{
:
{
}
}
,
[
'a'
]
)
)
.
toEqual
(
false
)
;
expect
(
fieldsAreEqual
(
{
:
undefined
}
,
{
:
'hello'
}
,
[
'a'
]
)
)
.
toEqual
(
false
,
)
;
expect
(
fieldsAreEqual
(
{
:
false
}
,
{
:
true
}
,
[
'a'
]
)
)
.
toEqual
(
false
)
;
expect
(
fieldsAreEqual
(
{
:
{
:
{
:
'hello'
}
}
}
,
{
:
{
:
{
:
'hell'
}
}
}
,
[
'a'
]
,
)
,
)
.
toEqual
(
false
)
;
expect
(
fieldsAreEqual
(
{
:
'true'
}
,
{
:
'true'
}
,
[
]
)
)
.
toEqual
(
false
)
;
}
)
;
}
)
;
suite
(
'fig/shared/ makeArray'
,
(
)
=>
{
test
(
'should transform an object into an array'
,
(
)
=>
{
expect
(
makeArray
(
true
)
)
.
toEqual
(
[
true
]
)
;
}
)
;
test
(
'should not transform arrays with one value'
,
(
)
=>
{
expect
(
makeArray
(
[
true
]
)
)
.
toEqual
(
[
true
]
)
;
}
)
;
test
(
'should not transform arrays with multiple values'
,
(
)
=>
{
expect
(
makeArray
(
[
true
,
false
]
)
)
.
toEqual
(
[
true
,
false
]
)
;
}
)
;
}
)
;
suite
(
'fig/shared/ makeArrayIfExists'
,
(
)
=>
{
test
(
'works'
,
(
)
=>
{
expect
(
makeArrayIfExists
(
null
)
)
.
toEqual
(
null
)
;
expect
(
makeArrayIfExists
(
undefined
)
)
.
toEqual
(
null
)
;
expect
(
makeArrayIfExists
(
'a'
)
)
.
toEqual
(
[
'a'
]
)
;
expect
(
makeArrayIfExists
(
[
'a'
]
)
)
.
toEqual
(
[
'a'
]
)
;
}
)
;
}
)
;
suite
(
'fig/shared/ longestCommonPrefix'
,
(
)
=>
{
test
(
'should return the shared match'
,
(
)
=>
{
expect
(
longestCommonPrefix
(
[
'foo'
,
'foo bar'
,
'foo hello world'
]
)
)
.
toEqual
(
'foo'
,
)
;
}
)
;
test
(
'should return nothing if not all items starts by the same chars'
,
(
)
=>
{
expect
(
longestCommonPrefix
(
[
'foo'
,
'foo bar'
,
'hello world'
]
)
)
.
toEqual
(
''
)
;
}
)
;
}
)
;
suite
(
'fig/shared/ compareNamedObjectsAlphabetically'
,
(
)
=>
{
test
(
'should return 1 to sort alphabetically z against b for string'
,
(
)
=>
{
ok
(
compareNamedObjectsAlphabetically
(
'z'
,
'b'
)
>
0
)
;
}
)
;
test
(
'should return 1 to sort alphabetically z against b for object with name'
,
(
)
=>
{
ok
(
compareNamedObjectsAlphabetically
(
{
:
'z'
}
,
{
:
'b'
}
)
>
0
)
;
}
)
;
test
(
'should return 1 to sort alphabetically c against x for object with name'
,
(
)
=>
{
ok
(
compareNamedObjectsAlphabetically
(
{
:
'c'
}
,
{
:
'x'
}
)
<
0
)
;
}
)
;
test
(
'should return 1 to sort alphabetically z against b for object with name array'
,
(
)
=>
{
ok
(
compareNamedObjectsAlphabetically
(
{
:
[
'z'
]
}
,
{
:
[
'b'
]
}
)
>
0
)
;
}
)
;
test
(
'should return 1 to sort alphabetically c against x for object with name array'
,
(
)
=>
{
ok
(
compareNamedObjectsAlphabetically
(
{
:
[
'c'
]
}
,
{
:
[
'x'
]
}
)
<
0
)
;
}
)
;
}
)
;