Skip to content

Commit 81d8c6d

Browse files
committed
fix(firestore, android): align pipeline timestampTruncate arity validation with iOS
1 parent c4f1f58 commit 81d8c6d

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

packages/firestore/android/src/reactnative/java/io/invertase/firebase/firestore/ReactNativeFirebaseFirestorePipelineNodeBuilder.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,14 @@ && tryEnterComparisonOperandConstant(enterFrame, stack)) {
16751675
}
16761676
case "timestamptruncate":
16771677
{
1678+
if (args.size() != 2) {
1679+
throw new ReactNativeFirebaseFirestorePipelineExecutor.PipelineValidationException(
1680+
"pipelineExecute() expected "
1681+
+ operationFieldName
1682+
+ "."
1683+
+ operation.originalName
1684+
+ " to include exactly 2 arguments.");
1685+
}
16781686
Object granularityArg = args.get(1);
16791687
if (!containsLowerableExpression(granularityArg)) {
16801688
Object granularityValue =
@@ -2052,12 +2060,9 @@ private void scheduleExpressionFunctionLowering(
20522060
scheduleReceiverExpressionChain(normalizedName, functionName, args, fieldName, box, stack);
20532061
return;
20542062
case "timestamptruncate":
2055-
if (args.size() == 2) {
2056-
scheduleReceiverExpressionChain(
2057-
normalizedName, functionName, args, fieldName, box, stack);
2058-
return;
2059-
}
2060-
box.value = null;
2063+
requireArgumentCount(args, 2, functionName, fieldName);
2064+
scheduleReceiverExpressionChain(
2065+
normalizedName, functionName, args, fieldName, box, stack);
20612066
return;
20622067
default:
20632068
scheduleRawExpressionFunction(functionName, args, fieldName, box, stack);

packages/firestore/e2e/Pipeline.e2e.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,12 +3024,7 @@ describe('FirestorePipeline', function () {
30243024
.documents([docPath])
30253025
.select(timestampTruncate(field('eventTime')).as('badTruncate')),
30263026
),
3027-
[
3028-
'pipelineExecute() expected',
3029-
'invalid-argument',
3030-
'Failed to execute pipeline',
3031-
'null object reference',
3032-
],
3027+
['pipelineExecute() expected', 'invalid-argument', 'Failed to execute pipeline'],
30333028
);
30343029
});
30353030
});

0 commit comments

Comments
 (0)