Skip to content

Commit c19379d

Browse files
committed
Fixed formatting
1 parent 43b6bbc commit c19379d

File tree

4 files changed

+163
-162
lines changed

4 files changed

+163
-162
lines changed

packages/pinia/__tests__/devtools/utils.spec.ts

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { describe, it, expect } from 'vitest'
22
import { formatStateDifferences, realTypeOf } from '../../src/devtools/utils'
33

44
describe('Devtools utils', () => {
5-
65
describe('realTypeOf', () => {
76
it('Should correctly predict type of subject', () => {
87
const number = 0
@@ -56,7 +55,7 @@ describe('Devtools utils', () => {
5655
describe('formatStateDifferences', () => {
5756
it('Should find removed entries', () => {
5857
const oldState = {
59-
removed: 'old'
58+
removed: 'old',
6059
}
6160
const newState = {}
6261

@@ -71,30 +70,30 @@ describe('Devtools utils', () => {
7170
const oldState = {
7271
changedArray1: [1, 2, 3],
7372
unchangedArray: [1, 2, 3],
74-
changedArray2: [1, 2, 3]
73+
changedArray2: [1, 2, 3],
7574
}
7675
const newState = {
7776
changedArray1: [1, 2, 3, 4],
7877
unchangedArray: [1, 2, 3],
79-
changedArray2: [3, 2, 1]
78+
changedArray2: [3, 2, 1],
8079
}
8180

8281
const differences = formatStateDifferences(oldState, newState)
8382

8483
expect(differences).toEqual({
8584
changedArray1: [1, 2, 3, 4],
86-
changedArray2: [3, 2, 1]
85+
changedArray2: [3, 2, 1],
8786
})
8887
})
8988

9089
it('Should find difference in regexp', () => {
9190
const oldState = {
9291
changedRegexp: /changed/,
93-
unchangedRegexp: /unchanged/
92+
unchangedRegexp: /unchanged/,
9493
}
9594
const newState = {
9695
changedRegexp: /changedToNewValue/,
97-
unchangedRegexp: /unchanged/
96+
unchangedRegexp: /unchanged/,
9897
}
9998

10099
const differences = formatStateDifferences(oldState, newState)
@@ -107,11 +106,11 @@ describe('Devtools utils', () => {
107106
it('Should find difference in date', () => {
108107
const oldState = {
109108
changedDate: new Date(123),
110-
unchangedDate: new Date(123)
109+
unchangedDate: new Date(123),
111110
}
112111
const newState = {
113112
changedDate: new Date(1234),
114-
unchangedDate: new Date(123)
113+
unchangedDate: new Date(123),
115114
}
116115

117116
const differences = formatStateDifferences(oldState, newState)
@@ -124,11 +123,11 @@ describe('Devtools utils', () => {
124123
it('Should find difference in booleans', () => {
125124
const oldState = {
126125
changedBool: true,
127-
unchangedBool: true
126+
unchangedBool: true,
128127
}
129128
const newState = {
130129
changedBool: false,
131-
unchangedBool: true
130+
unchangedBool: true,
132131
}
133132

134133
const differences = formatStateDifferences(oldState, newState)
@@ -141,11 +140,11 @@ describe('Devtools utils', () => {
141140
it('Should find difference in numbers', () => {
142141
const oldState = {
143142
changedNumber: 10,
144-
unchangedNumber: 10
143+
unchangedNumber: 10,
145144
}
146145
const newState = {
147146
changedNumber: 9,
148-
unchangedNumber: 10
147+
unchangedNumber: 10,
149148
}
150149

151150
const differences = formatStateDifferences(oldState, newState)
@@ -158,11 +157,11 @@ describe('Devtools utils', () => {
158157
it('Should find difference in strings', () => {
159158
const oldState = {
160159
changedString: 'changed',
161-
unchangedString: 'unchanged'
160+
unchangedString: 'unchanged',
162161
}
163162
const newState = {
164163
changedString: 'changedToNewValue',
165-
unchangedString: 'unchanged'
164+
unchangedString: 'unchanged',
166165
}
167166

168167
const differences = formatStateDifferences(oldState, newState)
@@ -173,16 +172,15 @@ describe('Devtools utils', () => {
173172
})
174173

175174
it('Should find new values', () => {
176-
const oldState = {
177-
}
175+
const oldState = {}
178176
const newState = {
179-
newValue: 10
177+
newValue: 10,
180178
}
181179

182180
const differences = formatStateDifferences(oldState, newState)
183181

184182
expect(differences).toEqual({
185-
newValue: 10
183+
newValue: 10,
186184
})
187185
})
188186

@@ -194,20 +192,20 @@ describe('Devtools utils', () => {
194192
key1: {
195193
key1: {
196194
key1: false,
197-
key2: true
198-
}
199-
}
195+
key2: true,
196+
},
197+
},
200198
},
201199
key3: {
202200
key1: {
203-
key1: {}
201+
key1: {},
204202
},
205203
key2: {
206-
key1: 'abc'
207-
}
204+
key1: 'abc',
205+
},
208206
},
209-
key4: 50
210-
}
207+
key4: 50,
208+
},
211209
}
212210
const newState = {
213211
changedObject: {
@@ -216,20 +214,20 @@ describe('Devtools utils', () => {
216214
key1: {
217215
key1: {
218216
key1: true,
219-
key2: true
220-
}
221-
}
217+
key2: true,
218+
},
219+
},
222220
},
223221
key3: {
224222
key1: {
225-
key1: {}
223+
key1: {},
226224
},
227225
key2: {
228-
key1: 'abcd'
229-
}
226+
key1: 'abcd',
227+
},
230228
},
231-
key4: 50
232-
}
229+
key4: 50,
230+
},
233231
}
234232

235233
const differences = formatStateDifferences(oldState, newState)
@@ -240,15 +238,15 @@ describe('Devtools utils', () => {
240238
key1: {
241239
key1: {
242240
key1: true,
243-
}
244-
}
241+
},
242+
},
245243
},
246244
key3: {
247245
key2: {
248-
key1: 'abcd'
249-
}
246+
key1: 'abcd',
247+
},
250248
},
251-
}
249+
},
252250
})
253251
})
254252

@@ -259,19 +257,19 @@ describe('Devtools utils', () => {
259257

260258
const oldState = {
261259
foo,
262-
bar
260+
bar,
263261
}
264262

265263
const newState = {
266264
foo: foobar,
267-
bar
265+
bar,
268266
}
269267

270268
const differences = formatStateDifferences(oldState, newState)
271269

272270
expect(differences).toEqual({
273-
foo: foobar
271+
foo: foobar,
274272
})
275273
})
276274
})
277-
})
275+
})

0 commit comments

Comments
 (0)