mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-11 04:41:17 +02:00
24 lines
752 B
TypeScript
24 lines
752 B
TypeScript
import { useAtomRef } from "@effect/atom-vue"
|
|
import { assert, describe, it } from "@effect/vitest"
|
|
import * as AtomRef from "effect/reactivity/AtomRef"
|
|
import { effectScope, nextTick, shallowRef } from "vue"
|
|
|
|
describe("atom-vue", () => {
|
|
describe("useAtomRef", () => {
|
|
it("publishes the current value when the selected ref changes", async () => {
|
|
const first = AtomRef.make(1)
|
|
const second = AtomRef.make(10)
|
|
const selected = shallowRef(first)
|
|
const scope = effectScope()
|
|
try {
|
|
const value = scope.run(() => useAtomRef(() => selected.value))!
|
|
|
|
selected.value = second
|
|
await nextTick()
|
|
assert.strictEqual(value.value, 10)
|
|
} finally {
|
|
scope.stop()
|
|
}
|
|
})
|
|
})
|
|
})
|