@@ -2,9 +2,9 @@ import { inject, InjectionToken, isSignal, signal } from '@angular/core';
2
2
import { TestBed } from '@angular/core/testing' ;
3
3
import {
4
4
signalStore ,
5
+ withComputed ,
5
6
withHooks ,
6
7
withMethods ,
7
- withSignals ,
8
8
withState ,
9
9
} from '../src' ;
10
10
import { STATE_SIGNAL } from '../src/signal-state' ;
@@ -84,12 +84,12 @@ describe('signalStore', () => {
84
84
} ) ;
85
85
} ) ;
86
86
87
- describe ( 'withSignals ' , ( ) => {
87
+ describe ( 'withComputed ' , ( ) => {
88
88
it ( 'provides previously defined state slices and computed signals as input argument' , ( ) => {
89
89
const Store = signalStore (
90
90
withState ( ( ) => ( { foo : 'foo' } ) ) ,
91
- withSignals ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
92
- withSignals ( ( { foo, bar } ) => {
91
+ withComputed ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
92
+ withComputed ( ( { foo, bar } ) => {
93
93
expect ( foo ( ) ) . toBe ( 'foo' ) ;
94
94
expect ( bar ( ) ) . toBe ( 'bar' ) ;
95
95
@@ -105,12 +105,12 @@ describe('signalStore', () => {
105
105
expect ( store . baz ( ) ) . toBe ( 'baz' ) ;
106
106
} ) ;
107
107
108
- it ( 'executes withSignals factory in injection context' , ( ) => {
108
+ it ( 'executes withComputed factory in injection context' , ( ) => {
109
109
const TOKEN = new InjectionToken ( 'TOKEN' , {
110
110
providedIn : 'root' ,
111
111
factory : ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ,
112
112
} ) ;
113
- const Store = signalStore ( withSignals ( ( ) => inject ( TOKEN ) ) ) ;
113
+ const Store = signalStore ( withComputed ( ( ) => inject ( TOKEN ) ) ) ;
114
114
115
115
TestBed . configureTestingModule ( { providers : [ Store ] } ) ;
116
116
const store = TestBed . inject ( Store ) ;
@@ -123,7 +123,7 @@ describe('signalStore', () => {
123
123
it ( 'provides previously defined store properties as an input argument' , ( ) => {
124
124
const Store = signalStore (
125
125
withState ( ( ) => ( { foo : 'foo' } ) ) ,
126
- withSignals ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
126
+ withComputed ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
127
127
withMethods ( ( ) => ( { baz : ( ) => 'baz' } ) ) ,
128
128
withMethods ( ( store ) => {
129
129
expect ( store [ STATE_SIGNAL ] ( ) ) . toEqual ( { foo : 'foo' } ) ;
@@ -199,7 +199,7 @@ describe('signalStore', () => {
199
199
let message = '' ;
200
200
const Store = signalStore (
201
201
withState ( ( ) => ( { foo : 'foo' } ) ) ,
202
- withSignals ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
202
+ withComputed ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
203
203
withMethods ( ( ) => ( { baz : ( ) => 'baz' } ) ) ,
204
204
withHooks ( {
205
205
onInit ( store ) {
@@ -221,7 +221,7 @@ describe('signalStore', () => {
221
221
let message = '' ;
222
222
const Store = signalStore (
223
223
withState ( ( ) => ( { foo : 'foo' } ) ) ,
224
- withSignals ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
224
+ withComputed ( ( ) => ( { bar : signal ( 'bar' ) . asReadonly ( ) } ) ) ,
225
225
withMethods ( ( ) => ( { baz : ( ) => 'baz' } ) ) ,
226
226
withHooks ( {
227
227
onDestroy ( store ) {
@@ -269,7 +269,7 @@ describe('signalStore', () => {
269
269
it ( 'overrides previously defined store properties immutably' , ( ) => {
270
270
const Store = signalStore (
271
271
withState ( { i : 1 , j : 2 , k : 3 , l : 4 } ) ,
272
- withSignals ( ( { i, j, k, l } ) => {
272
+ withComputed ( ( { i, j, k, l } ) => {
273
273
expect ( i ( ) ) . toBe ( 1 ) ;
274
274
expect ( j ( ) ) . toBe ( 2 ) ;
275
275
expect ( k ( ) ) . toBe ( 3 ) ;
0 commit comments