react-code-dataset
/
react-query
/packages
/angular-query-experimental
/src
/__tests__
/signal-proxy.test.ts
| import { isSignal, signal } from '@angular/core' | |
| import { describe, expect, test } from 'vitest' | |
| import { signalProxy } from '../signal-proxy' | |
| describe('signalProxy', () => { | |
| const inputSignal = signal({ fn: () => 'bar', baz: 'qux' }) | |
| const proxy = signalProxy(inputSignal) | |
| test('should have computed fields', () => { | |
| expect(proxy.baz()).toEqual('qux') | |
| expect(isSignal(proxy.baz)).toBe(true) | |
| }) | |
| test('should pass through functions as-is', () => { | |
| expect(proxy.fn()).toEqual('bar') | |
| expect(isSignal(proxy.fn)).toBe(false) | |
| }) | |
| test('supports "in" operator', () => { | |
| expect('baz' in proxy).toBe(true) | |
| expect('foo' in proxy).toBe(false) | |
| }) | |
| test('supports "Object.keys"', () => { | |
| expect(Object.keys(proxy)).toEqual(['fn', 'baz']) | |
| }) | |
| }) | |