Skip to content

Commit 10c5690

Browse files
committed
test: move prop-specific tests into "describeProps"
1 parent a613c49 commit 10c5690

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

packages/core/src/SpringValue.test.ts

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,7 @@ describe('SpringValue', () => {
1414
expect(frames).toMatchSnapshot()
1515
})
1616

17-
describe('when "from" prop is changed', () => {
18-
describe('before the first animation', () => {
19-
it.todo('updates the current value')
20-
})
21-
describe('after the first animation', () => {
22-
it.todo('does nothing unless "reset" is true')
23-
})
24-
})
25-
26-
describe('when "to" prop is changed', () => {
27-
it.todo('resolves the "start" promise with (finished: false)')
28-
it.todo('avoids calling the "onStart" prop')
29-
it.todo('avoids calling the "onRest" prop')
30-
})
31-
32-
describe('when "reset" prop is true', () => {
33-
it.todo('resolves the "start" promise with (finished: false)')
34-
it.todo('calls the "onRest" prop with (finished: false)')
35-
})
36-
37-
describe('when "immediate" prop is true', () => {
38-
it.todo('still resolves the "start" promise')
39-
it.todo('never calls the "onStart" prop')
40-
it.todo('never calls the "onRest" prop')
41-
})
17+
describeProps()
4218

4319
describe('"set" method', () => {
4420
it('stops the active animation', async () => {
@@ -97,6 +73,34 @@ describe('SpringValue', () => {
9773
})
9874
})
9975

76+
function describeProps() {
77+
describe('when "from" prop is changed', () => {
78+
describe('before the first animation', () => {
79+
it('updates the current value', () => {})
80+
})
81+
describe('after the first animation', () => {
82+
it.todo('does nothing unless "reset" is true')
83+
})
84+
})
85+
86+
describe('when "to" prop is changed', () => {
87+
it.todo('resolves the "start" promise with (finished: false)')
88+
it.todo('avoids calling the "onStart" prop')
89+
it.todo('avoids calling the "onRest" prop')
90+
})
91+
92+
describe('when "reset" prop is true', () => {
93+
it.todo('resolves the "start" promise with (finished: false)')
94+
it.todo('calls the "onRest" prop with (finished: false)')
95+
})
96+
97+
describe('when "immediate" prop is true', () => {
98+
it.todo('still resolves the "start" promise')
99+
it.todo('never calls the "onStart" prop')
100+
it.todo('never calls the "onRest" prop')
101+
})
102+
}
103+
100104
/** The minimum requirements for testing a dynamic target */
101105
type OpaqueTarget = {
102106
node: FrameValue

0 commit comments

Comments
 (0)