-
Notifications
You must be signed in to change notification settings - Fork 62
Adding some tests for checking the spreading behaviour of objects returned by a worklet. #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
3494b92
2dce0cd
b0ae71e
9a091aa
c1c6db9
025fada
a350935
4ac3d42
ff989e3
a884258
7896b5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -197,6 +197,35 @@ export const worklet_tests = { | |
| }); | ||
| return ExpectValue(result, 42); | ||
| }, | ||
| check_jsi_object_is_spreadable_after_worklet: async () => { | ||
| const fw = () => { | ||
| "worklet"; | ||
| return { a: 100 }; | ||
| }; | ||
| let wf = Worklets.defaultContext.createRunAsync(fw); | ||
| const result = await wf(); | ||
| const spreadObject = { ...result }; | ||
| return ExpectValue(spreadObject, { a: 100 }); | ||
| }, | ||
| check_jsi_object_is_assignable_after_worklet: async () => { | ||
| const fw = () => { | ||
| "worklet"; | ||
| return { a: 100 }; | ||
| }; | ||
| let wf = Worklets.defaultContext.createRunAsync(fw); | ||
|
||
| const result = await wf(); | ||
| const assignedObject = Object.assign({}, result); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the problem was when using Object.assign/spread inside a Worklet?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I have added a test below to show that spreading inside the worklet works as expected. |
||
| return ExpectValue(assignedObject, { a: 100 }); | ||
| }, | ||
| check_jsi_object_is_returned_from_worklet: async () => { | ||
| const fw = () => { | ||
| "worklet"; | ||
| return { a: 100, b: "200" }; | ||
| }; | ||
| let wf = Worklets.defaultContext.createRunAsync(fw); | ||
| const result = await wf(); | ||
| return ExpectValue(result, { a: 100, b: "200" }); | ||
| }, | ||
| check_worklet_checker_works: () => { | ||
| const func = () => { | ||
| "worklet"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use better naming than two characters - something like
funchereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed