File tree 3 files changed +27
-10
lines changed
3 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -2410,19 +2410,23 @@ defmodule Ash do
2410
2410
2411
2411
case inputs do
2412
2412
[ ] ->
2413
- result = % Ash.BulkResult { status: :success , errors: [ ] }
2413
+ if opts [ :return_stream? ] do
2414
+ [ ]
2415
+ else
2416
+ result = % Ash.BulkResult { status: :success , errors: [ ] }
2414
2417
2415
- result =
2416
- if opts [ :return_records? ] do
2417
- % { result | records: [ ] }
2418
+ result =
2419
+ if opts [ :return_records? ] do
2420
+ % { result | records: [ ] }
2421
+ else
2422
+ result
2423
+ end
2424
+
2425
+ if opts [ :return_notifications? ] do
2426
+ % { result | notifications: [ ] }
2418
2427
else
2419
2428
result
2420
2429
end
2421
-
2422
- if opts [ :return_notifications? ] do
2423
- % { result | notifications: [ ] }
2424
- else
2425
- result
2426
2430
end
2427
2431
2428
2432
inputs ->
Original file line number Diff line number Diff line change @@ -1200,6 +1200,19 @@ defmodule Ash.Test.Actions.BulkCreateTest do
1200
1200
end
1201
1201
1202
1202
describe "streaming" do
1203
+ test "a stream is returned when inputs are empty" do
1204
+ assert [ ] =
1205
+ [ ]
1206
+ |> Ash . bulk_create! (
1207
+ Post ,
1208
+ :create_with_policy ,
1209
+ authorize?: true ,
1210
+ return_stream?: true ,
1211
+ return_records?: true
1212
+ )
1213
+ |> Enum . to_list ( )
1214
+ end
1215
+
1203
1216
test "by default nothing is returned in the stream" do
1204
1217
org =
1205
1218
Org
Original file line number Diff line number Diff line change 1
1
defmodule Ash.Test.Actions.UpdateTest do
2
2
@ moduledoc false
3
3
require Ash.Flags
4
- use ExUnit.Case , async: true
4
+ use ExUnit.Case , async: false
5
5
6
6
import Ash.Test
7
7
require Ash.Query
You can’t perform that action at this time.
0 commit comments