Skip to content

Commit

Permalink
test(react): add test code for the Wrap class (#1156)
Browse files Browse the repository at this point in the history
# Overview
- add test code for the Wrap class

### before
<img width="759" alt="before"
src="https://github.com/user-attachments/assets/ceb9e7be-c9ae-4c21-8d1a-eece16540aa4">


### after
<img width="759" alt="after"
src="https://github.com/user-attachments/assets/78eb98cc-2b1c-4bc0-bbd0-bf3d1d3a04e6">


## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.

Co-authored-by: kinndohyun <[email protected]>
Co-authored-by: GwanSik Kim <[email protected]>
  • Loading branch information
3 people authored Jul 28, 2024
1 parent c3c7e60 commit a9bb395
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/react/src/wrap.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,16 @@ describe('wrap.Delay().on', () => {
expect(wrap.Delay({}).on(() => <></>).displayName).toBe('wrap.Delay.on(Component)')
})
})

describe('Wrap class method chaining', () => {
it('should maintain the same instance across method chaining', () => {
const suspenseInstance = wrap.Suspense({})
const methodChainingInstance = suspenseInstance
.ErrorBoundary({ fallback: FALLBACK })
.ErrorBoundaryGroup({})
.Delay({})
.Suspense({})

expect(suspenseInstance).toBe(methodChainingInstance)
})
})

0 comments on commit a9bb395

Please sign in to comment.