t3-code-android-nightly/.repos/effect-smol/packages/atom/vue/test/index.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

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()
}
})
})
})