Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
test: update test
  • Loading branch information
jh-leong committed Sep 9, 2024
1 parent 4effc9d commit f571f71
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/runtime-core/__tests__/helpers/renderList.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isReactive, reactive, shallowReactive } from '../../src/index'
import { renderList } from '../../src/helpers/renderList'

describe('renderList', () => {
Expand Down Expand Up @@ -56,4 +57,12 @@ describe('renderList', () => {
renderList(undefined, (item, index) => `node ${index}: ${item}`),
).toEqual([])
})

it('should render items in a reactive array correctly', () => {
const reactiveArray = reactive([{ foo: 1 }])
expect(renderList(reactiveArray, isReactive)).toEqual([true])

const shallowReactiveArray = shallowReactive([{ foo: 1 }])
expect(renderList(shallowReactiveArray, isReactive)).toEqual([false])
})
})

0 comments on commit f571f71

Please sign in to comment.