@@ -1090,6 +1090,98 @@ describe("AsyncResult", () => {
1090
1090
|> toEqual(13 )
1091
1091
);
1092
1092
1093
+ test("alt (Init, Init)" , () =>
1094
+ AsyncResult . (alt(Init , Init ) |> expect |> toEqual(init))
1095
+ );
1096
+
1097
+ test("alt (Init, Loading)" , () =>
1098
+ AsyncResult . (alt(Init , Loading ) |> expect |> toEqual(loading))
1099
+ );
1100
+
1101
+ test("alt (Init, Reloading(Error))" , () =>
1102
+ AsyncResult . (alt(Init , Reloading (Error (0 ))) |> expect |> toEqual(init))
1103
+ );
1104
+
1105
+ test("alt (Init, Reloading(Ok))" , () =>
1106
+ AsyncResult . (
1107
+ alt(Init , Reloading (Ok (0 ))) |> expect |> toEqual(reloadingOk(0 ))
1108
+ )
1109
+ );
1110
+
1111
+ test("alt (Init, Complete(Error))" , () =>
1112
+ AsyncResult . (alt(Init , Complete (Error (0 ))) |> expect |> toEqual(init))
1113
+ );
1114
+
1115
+ test("alt (Init, Complete(Ok))" , () =>
1116
+ AsyncResult . (
1117
+ alt(Init , Complete (Ok (0 ))) |> expect |> toEqual(completeOk(0 ))
1118
+ )
1119
+ );
1120
+
1121
+ test("alt (Loading, Init)" , () =>
1122
+ AsyncResult . (alt(Loading , Init ) |> expect |> toEqual(loading))
1123
+ );
1124
+
1125
+ test("alt (Reloading(Error), Init)" , () =>
1126
+ AsyncResult . (alt(Reloading (Error (1 )), Init ) |> expect |> toEqual(init))
1127
+ );
1128
+
1129
+ test("alt (Reloading(Error), Loading)" , () =>
1130
+ AsyncResult . (
1131
+ alt(Reloading (Error (1 )), Loading ) |> expect |> toEqual(loading)
1132
+ )
1133
+ );
1134
+
1135
+ test("alt (Reloading(Error), Reloading(Error))" , () =>
1136
+ AsyncResult . (
1137
+ alt(Reloading (Error (1 )), Reloading (Error (2 )))
1138
+ |> expect
1139
+ |> toEqual(reloadingError(1 ))
1140
+ )
1141
+ );
1142
+
1143
+ test("alt (Reloading(Error), Complete(Error))" , () =>
1144
+ AsyncResult . (
1145
+ alt(Reloading (Error (1 )), Complete (Error (2 )))
1146
+ |> expect
1147
+ |> toEqual(completeError(2 ))
1148
+ )
1149
+ );
1150
+
1151
+ test("alt (Complete(Error), Init)" , () =>
1152
+ AsyncResult . (alt(Complete (Error (1 )), Init ) |> expect |> toEqual(init))
1153
+ );
1154
+
1155
+ test("alt (Complete(Error), Loading)" , () =>
1156
+ AsyncResult . (
1157
+ alt(Complete (Error (1 )), Loading ) |> expect |> toEqual(loading)
1158
+ )
1159
+ );
1160
+
1161
+ test("alt (Complete(Error), Reloading(Error))" , () =>
1162
+ AsyncResult . (
1163
+ alt(Complete (Error (1 )), Reloading (Error (2 )))
1164
+ |> expect
1165
+ |> toEqual(completeError(1 ))
1166
+ )
1167
+ );
1168
+
1169
+ test("alt (Complete(Error), Reloading(Ok))" , () =>
1170
+ AsyncResult . (
1171
+ alt(Complete (Error (1 )), Reloading (Ok (2 )))
1172
+ |> expect
1173
+ |> toEqual(reloadingOk(2 ))
1174
+ )
1175
+ );
1176
+
1177
+ test("alt (Complete(Error), Complete(Error))" , () =>
1178
+ AsyncResult . (
1179
+ alt(Complete (Error (1 )), Complete (Error (2 )))
1180
+ |> expect
1181
+ |> toEqual(completeError(1 ))
1182
+ )
1183
+ );
1184
+
1093
1185
test("fromAsyncData Init" , () =>
1094
1186
AsyncData . init
1095
1187
|> AsyncResult . fromAsyncData
0 commit comments