Skip to content

Commit e65fd54

Browse files
committed
Refactor tests formatting in overmind-svelte
Adjusts formatting and indentation in test files for readability and consistency. Changes include converting single-line expects and callbacks to multi-line, adding parentheses around arrow function params, and aligning object matchers. No behavioral or logic changes to tests; only stylistic edits in packages/overmind-svelte/src/index.test.ts and index.production.test.ts.
1 parent 96ba2ed commit e65fd54

File tree

2 files changed

+40
-24
lines changed

2 files changed

+40
-24
lines changed

packages/overmind-svelte/src/index.production.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ describe('overmind-svelte (production mode)', () => {
7777
mixin.actions.increase()
7878

7979
const devtoolsCalls = eventSpy.mock.calls.filter(
80-
call => call[0] === EventType.COMPONENT_ADD ||
81-
call[0] === EventType.COMPONENT_UPDATE
80+
(call) =>
81+
call[0] === EventType.COMPONENT_ADD ||
82+
call[0] === EventType.COMPONENT_UPDATE
8283
)
8384
expect(devtoolsCalls).toHaveLength(0)
8485
})

packages/overmind-svelte/src/index.test.ts

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ describe('overmind-svelte', () => {
7373
mixin.state.subscribe(listener)
7474

7575
expect(listener).toHaveBeenCalledTimes(1)
76-
expect(listener).toHaveBeenCalledWith(expect.objectContaining({ count: 0 }))
76+
expect(listener).toHaveBeenCalledWith(
77+
expect.objectContaining({ count: 0 })
78+
)
7779
})
7880

7981
test('should call listener when tracked state changes', () => {
@@ -110,12 +112,15 @@ describe('overmind-svelte', () => {
110112
const onMountCallback = mockOnMount.mock.calls[0][0]
111113
onMountCallback()
112114

113-
expect(eventSpy).toHaveBeenCalledWith(EventType.COMPONENT_ADD, expect.objectContaining({
114-
componentId: expect.any(Number),
115-
componentInstanceId: expect.any(Number),
116-
name: '',
117-
paths: expect.any(Array),
118-
}))
115+
expect(eventSpy).toHaveBeenCalledWith(
116+
EventType.COMPONENT_ADD,
117+
expect.objectContaining({
118+
componentId: expect.any(Number),
119+
componentInstanceId: expect.any(Number),
120+
name: '',
121+
paths: expect.any(Array),
122+
})
123+
)
119124
})
120125

121126
test('should emit COMPONENT_UPDATE on state change', () => {
@@ -131,13 +136,16 @@ describe('overmind-svelte', () => {
131136

132137
mixin.actions.increase()
133138

134-
expect(eventSpy).toHaveBeenCalledWith(EventType.COMPONENT_UPDATE, expect.objectContaining({
135-
componentId: expect.any(Number),
136-
componentInstanceId: expect.any(Number),
137-
name: '',
138-
flushId: expect.any(Number),
139-
paths: expect.any(Array),
140-
}))
139+
expect(eventSpy).toHaveBeenCalledWith(
140+
EventType.COMPONENT_UPDATE,
141+
expect.objectContaining({
142+
componentId: expect.any(Number),
143+
componentInstanceId: expect.any(Number),
144+
name: '',
145+
flushId: expect.any(Number),
146+
paths: expect.any(Array),
147+
})
148+
)
141149
})
142150

143151
test('should not emit COMPONENT_UPDATE when no state change occurs', () => {
@@ -153,7 +161,7 @@ describe('overmind-svelte', () => {
153161

154162
// No action dispatched — no COMPONENT_UPDATE expected
155163
const updateCalls = eventSpy.mock.calls.filter(
156-
call => call[0] === EventType.COMPONENT_UPDATE
164+
(call) => call[0] === EventType.COMPONENT_UPDATE
157165
)
158166
expect(updateCalls).toHaveLength(0)
159167
})
@@ -174,20 +182,27 @@ describe('overmind-svelte', () => {
174182
unsubscribe()
175183

176184
expect(disposeSpy).toHaveBeenCalled()
177-
expect(eventSpy).toHaveBeenCalledWith(EventType.COMPONENT_REMOVE, expect.objectContaining({
178-
componentId: expect.any(Number),
179-
componentInstanceId: expect.any(Number),
180-
name: '',
181-
}))
185+
expect(eventSpy).toHaveBeenCalledWith(
186+
EventType.COMPONENT_REMOVE,
187+
expect.objectContaining({
188+
componentId: expect.any(Number),
189+
componentInstanceId: expect.any(Number),
190+
name: '',
191+
})
192+
)
182193
})
183194

184195
test('should support multiple independent subscribers', () => {
185196
const overmind = new Overmind(app)
186197
const mixin = createMixin(overmind)
187198
let count1 = -1
188199
let count2 = -1
189-
const listener1 = jest.fn((state) => { count1 = state.count })
190-
const listener2 = jest.fn((state) => { count2 = state.count })
200+
const listener1 = jest.fn((state) => {
201+
count1 = state.count
202+
})
203+
const listener2 = jest.fn((state) => {
204+
count2 = state.count
205+
})
191206

192207
const unsub1 = mixin.state.subscribe(listener1)
193208
const unsub2 = mixin.state.subscribe(listener2)

0 commit comments

Comments
 (0)