|  | 
| 6 | 6 |  * found in the LICENSE file at https://angular.dev/license | 
| 7 | 7 |  */ | 
| 8 | 8 | 
 | 
| 9 |  | -import {computed, isSignal, signal} from '../../src/core'; | 
|  | 9 | +import {computed, isSignal, isWritableSignal, signal} from '../../src/core'; | 
| 10 | 10 | 
 | 
| 11 | 11 | describe('isSignal', () => { | 
| 12 | 12 |   it('should return true for writable signal', () => { | 
| @@ -34,3 +34,30 @@ describe('isSignal', () => { | 
| 34 | 34 |     expect(isSignal(fn)).toBe(false); | 
| 35 | 35 |   }); | 
| 36 | 36 | }); | 
|  | 37 | + | 
|  | 38 | +describe('isWritableSignal', () => { | 
|  | 39 | +  it('should return true for writable signal', () => { | 
|  | 40 | +    const writableSignal = signal('Angular'); | 
|  | 41 | +    expect(isWritableSignal(writableSignal)).toBe(true); | 
|  | 42 | +  }); | 
|  | 43 | + | 
|  | 44 | +  it('should return false for readonly signal', () => { | 
|  | 45 | +    const readonlySignal = computed(() => 10); | 
|  | 46 | +    expect(isWritableSignal(readonlySignal)).toBe(false); | 
|  | 47 | +  }); | 
|  | 48 | + | 
|  | 49 | +  it('should return false for primitive', () => { | 
|  | 50 | +    const primitive = 0; | 
|  | 51 | +    expect(isWritableSignal(primitive)).toBe(false); | 
|  | 52 | +  }); | 
|  | 53 | + | 
|  | 54 | +  it('should return false for object', () => { | 
|  | 55 | +    const object = {name: 'Angular'}; | 
|  | 56 | +    expect(isWritableSignal(object)).toBe(false); | 
|  | 57 | +  }); | 
|  | 58 | + | 
|  | 59 | +  it('should return false for function', () => { | 
|  | 60 | +    const fn = () => {}; | 
|  | 61 | +    expect(isWritableSignal(fn)).toBe(false); | 
|  | 62 | +  }); | 
|  | 63 | +}); | 
0 commit comments