1
- import { listAttr , obj , ref , refSet , list , listAction , listRef , listRefSet , objArray , cases } from "../src/main" ;
1
+ import {
2
+ listAttribute ,
3
+ obj ,
4
+ reference ,
5
+ referenceSet ,
6
+ list ,
7
+ listAction ,
8
+ listReference ,
9
+ listReferenceSet ,
10
+ objArray ,
11
+ cases
12
+ } from "../src/main" ;
2
13
3
14
describe ( "prop mocking functions" , ( ) => {
4
15
describe ( "list" , ( ) => {
@@ -26,15 +37,15 @@ describe("prop mocking functions", () => {
26
37
} ) ;
27
38
} ) ;
28
39
29
- describe ( "listAttr " , ( ) => {
40
+ describe ( "listAttribute " , ( ) => {
30
41
it ( "returns ListAttributeValue mock" , ( ) => {
31
42
const t : Date = new Date ( "2024-09-01T00:00:00.000Z" ) ;
32
- const attr = listAttr ( ( ) => new Date ( t ) ) ;
43
+ const attr = listAttribute ( ( ) => new Date ( t ) ) ;
33
44
expect ( attr . get ( obj ( ) ) . value ! ) . toEqual ( t ) ;
34
45
} ) ;
35
46
} ) ;
36
47
37
- describe ( "listExp " , ( ) => {
48
+ describe ( "listExpression " , ( ) => {
38
49
it . todo ( "returns ListExpressionValue mock" ) ;
39
50
} ) ;
40
51
@@ -44,7 +55,7 @@ describe("prop mocking functions", () => {
44
55
45
56
describe ( "ref" , ( ) => {
46
57
it ( "returns ReferenceValue mock with undefined value" , ( ) => {
47
- const ref1 = ref ( ) ;
58
+ const ref1 = reference ( ) ;
48
59
expect ( ref1 ) . toMatchObject ( {
49
60
readOnly : false ,
50
61
status : "available" ,
@@ -57,7 +68,7 @@ describe("prop mocking functions", () => {
57
68
} ) ;
58
69
59
70
it ( "take factory as first argument" , ( ) => {
60
- const ref1 = ref ( builder => builder . withValue ( obj ( "0" ) ) . isLoading ( ) . build ( ) ) ;
71
+ const ref1 = reference ( builder => builder . withValue ( obj ( "0" ) ) . isLoading ( ) . build ( ) ) ;
61
72
expect ( ref1 ) . toMatchObject ( {
62
73
readOnly : true ,
63
74
status : "loading" ,
@@ -70,7 +81,7 @@ describe("prop mocking functions", () => {
70
81
71
82
describe ( "refSet" , ( ) => {
72
83
it ( "returns ReferenceSetValue mock with undefined value" , ( ) => {
73
- const ref1 = refSet ( ) ;
84
+ const ref1 = referenceSet ( ) ;
74
85
expect ( ref1 ) . toMatchObject ( {
75
86
readOnly : false ,
76
87
status : "available" ,
@@ -83,7 +94,7 @@ describe("prop mocking functions", () => {
83
94
} ) ;
84
95
85
96
it ( "take factory as first argument" , ( ) => {
86
- const ref1 = refSet ( builder =>
97
+ const ref1 = referenceSet ( builder =>
87
98
builder
88
99
. withValue ( [ obj ( "0" ) ] )
89
100
. isLoading ( )
@@ -99,17 +110,17 @@ describe("prop mocking functions", () => {
99
110
} ) ;
100
111
101
112
it ( "returns mock with working setValue" , ( ) => {
102
- const ref1 = refSet ( ) ;
113
+ const ref1 = referenceSet ( ) ;
103
114
ref1 . setValue ( [ obj ( "007" ) ] ) ;
104
115
expect ( ref1 . value ) . toEqual ( [ obj ( "007" ) ] ) ;
105
116
ref1 . setValue ( [ obj ( "939" ) ] ) ;
106
117
expect ( ref1 . value ) . toEqual ( [ obj ( "939" ) ] ) ;
107
118
} ) ;
108
119
} ) ;
109
120
110
- describe ( "listRef " , ( ) => {
121
+ describe ( "listReference " , ( ) => {
111
122
it ( "returns ListReferenceValue mock" , ( ) => {
112
- const prop = listRef ( ) ;
123
+ const prop = listReference ( ) ;
113
124
expect ( prop ) . toMatchObject ( {
114
125
type : "Reference" ,
115
126
filterable : true ,
@@ -126,9 +137,9 @@ describe("prop mocking functions", () => {
126
137
} ) ;
127
138
} ) ;
128
139
129
- describe ( "listRefSet " , ( ) => {
140
+ describe ( "listReferenceSet " , ( ) => {
130
141
it ( "returns ListReferenceSetValue mock" , ( ) => {
131
- const prop = listRefSet ( ) ;
142
+ const prop = listReferenceSet ( ) ;
132
143
expect ( prop ) . toMatchObject ( {
133
144
type : "ReferenceSet" ,
134
145
filterable : true ,
@@ -171,7 +182,7 @@ describe("prop mocking functions", () => {
171
182
const mapFn = cases ( [ a , "Alice" ] , [ b , "Bob" ] , [ c , "Chuck" ] , [ undefined , "None" ] ) ;
172
183
const props = {
173
184
datasource : list ( items ) ,
174
- name : listAttr ( mapFn )
185
+ name : listAttribute ( mapFn )
175
186
} ;
176
187
177
188
expect ( props . datasource . items ?. map ( item => props . name . get ( item ) . value ) ) . toEqual ( [
0 commit comments