Skip to content

Commit

Permalink
Update getPipelines to return a set of behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthiee committed May 12, 2024
1 parent af80949 commit def0084
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/src/request/pipeline/pipeline_behavior_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ class PipelineBehaviorStore implements PipelineConfigurator {
}

/// Returns all [PipelineBehavior]'s that match.
List<PipelineBehavior> getPipelines(
Set<PipelineBehavior> getPipelines(
Request request,
) {
final requestType = request.runtimeType;

final behaviors = _typedBehaviors[requestType];

return [
return {
if (behaviors != null) ...behaviors,
..._genericBehaviors,
];
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ void main() {

expect(
pipelineBehaviorStore.getPipelines(mockRequest),
[
{
correctBehavior,
PipelineBehavior.function(correctBehavior.handle),
PipelineBehavior.factory(correctFactory),
logBehavior,
PipelineBehavior.function(logBehavior.handle),
PipelineBehavior.factory(logBehaviorFactory),
],
},
);
});
});
Expand Down
6 changes: 3 additions & 3 deletions test/unit/request/requests_manager_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void main() {
.thenReturn(mockRequestHandler);

when(() => mockPipelineBehaviorStore.getPipelines(mockRequest))
.thenReturn([]);
.thenReturn({});

final result = await requestsManager.send(mockRequest);

Expand Down Expand Up @@ -134,7 +134,7 @@ void main() {
});

when(() => mockPipelineBehaviorStore.getPipelines(mockRequest))
.thenReturn([mockBehavior]);
.thenReturn({mockBehavior});

final result = await requestsManager.send(mockRequest);

Expand Down Expand Up @@ -166,7 +166,7 @@ void main() {
});

when(() => mockPipelineBehaviorStore.getPipelines(mockRequest))
.thenReturn([mockWrongBehavior]);
.thenReturn({mockWrongBehavior});

await expectLater(
() => requestsManager.send(mockRequest),
Expand Down

0 comments on commit def0084

Please sign in to comment.