Open History to see the last commit
1import { isSignal, signal } from '@angular/core'
2import { describe } from 'vitest'
3import { signalProxy } from '../signal-proxy'
4β
5describe('signalProxy', () => {
6 const inputSignal = signal({ fn: () => 'bar', baz: 'qux' })
7 const proxy = signalProxy(inputSignal)
8β
9 test('should have computed fields', () => {
10 expect(proxy.baz()).toEqual('qux')
11 expect(isSignal(proxy.baz)).toBe(true)
12 })
13β
14 test('should pass through functions as-is', () => {
15 expect(proxy.fn()).toEqual('bar')
16 expect(isSignal(proxy.fn)).toBe(false)
17 })
18β
19 test('supports "in" operator', () => {
20 expect('baz' in proxy).toBe(true)
21 expect('foo' in proxy).toBe(false)
22 })
23β
24 test('supports "Object.keys"', () => {
25 expect(Object.keys(proxy)).toEqual(['fn', 'baz'])
26 })
27})