@@ -11,7 +11,7 @@ describe("createLoadingStore", () => {
1111 } ) ;
1212
1313 it ( "should initialize with the correct state" , ( ) => {
14- const store = createLoadingStore ( mockFetcher , initialValue ) ;
14+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
1515
1616 expect ( store . state ( ) . state ) . toBe ( "unresolved" ) ;
1717 expect ( store . state ( ) . loading ) . toBe ( false ) ;
@@ -22,22 +22,22 @@ describe("createLoadingStore", () => {
2222 } ) ;
2323
2424 it ( "should transition to loading when load is called" , async ( ) => {
25- const store = createLoadingStore ( mockFetcher , initialValue ) ;
25+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
2626 store . load ( ) ;
2727
2828 expect ( store . state ( ) . state ) . toBe ( "pending" ) ;
2929 expect ( store . state ( ) . loading ) . toBe ( true ) ;
3030 } ) ;
3131
3232 it ( "should enable loading if ready is called" , async ( ) => {
33- const store = createLoadingStore ( mockFetcher , initialValue ) ;
33+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
3434 mockFetcher . mockResolvedValueOnce ( { data : "test" } ) ;
3535
3636 await store . ready ( ) ;
3737 } ) ;
3838
3939 it ( "should call the fetcher when load is called" , async ( ) => {
40- const store = createLoadingStore ( mockFetcher , initialValue ) ;
40+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
4141 mockFetcher . mockResolvedValueOnce ( { data : "test" } ) ;
4242 store . load ( ) ;
4343
@@ -50,7 +50,7 @@ describe("createLoadingStore", () => {
5050
5151 it ( "should handle error when fetcher fails" , async ( ) => {
5252 mockFetcher . mockRejectedValueOnce ( new Error ( "Failed to load" ) ) ;
53- const store = createLoadingStore ( mockFetcher , initialValue ) ;
53+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
5454
5555 store . load ( ) ;
5656
@@ -61,7 +61,7 @@ describe("createLoadingStore", () => {
6161 } ) ;
6262
6363 it ( "should transition to refreshing state on refresh" , async ( ) => {
64- const store = createLoadingStore ( mockFetcher , initialValue ) ;
64+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
6565 mockFetcher . mockResolvedValueOnce ( { data : "test" } ) ;
6666 store . load ( ) ;
6767
@@ -71,7 +71,7 @@ describe("createLoadingStore", () => {
7171 } ) ;
7272
7373 it ( "should trigger load when refresh is called and shouldLoad is false" , async ( ) => {
74- const store = createLoadingStore ( mockFetcher , initialValue ) ;
74+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
7575 mockFetcher . mockResolvedValueOnce ( { data : "test" } ) ;
7676 expect ( store . state ( ) . state ) . toBe ( "unresolved" ) ;
7777
@@ -88,7 +88,7 @@ describe("createLoadingStore", () => {
8888 } ) ;
8989
9090 it ( "should reset the store to its initial value on reset" , async ( ) => {
91- const store = createLoadingStore ( mockFetcher , initialValue ) ;
91+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
9292 mockFetcher . mockResolvedValueOnce ( { data : "test" } ) ;
9393 store . load ( ) ;
9494
@@ -103,7 +103,7 @@ describe("createLoadingStore", () => {
103103 } ) ;
104104
105105 it ( "should handle a promise rejection during reset" , async ( ) => {
106- const store = createLoadingStore ( mockFetcher , initialValue ) ;
106+ const store = createLoadingStore ( "test" , mockFetcher , initialValue ) ;
107107
108108 // Mock the fetcher to resolve with data
109109 mockFetcher . mockResolvedValueOnce ( { data : "test" } ) ;
0 commit comments