Skip to content

Commit 3106046

Browse files
committed
Adding Node test for multiple positional inputs
1 parent a5993b1 commit 3106046

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

test/WebJobs.Script.Tests/NodeEndToEndTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,30 @@ public async Task MultipleOutputs()
682682
Assert.Equal("Test Blob 3", blobContent.Trim());
683683
}
684684

685+
[Fact]
686+
public async Task MultipleInputs()
687+
{
688+
string id = Guid.NewGuid().ToString();
689+
690+
JObject input = new JObject
691+
{
692+
{ "id", id },
693+
{ "rk1", "001" },
694+
{ "rk2", "002" }
695+
};
696+
Dictionary<string, object> arguments = new Dictionary<string, object>
697+
{
698+
{ "input", input.ToString() }
699+
};
700+
await Fixture.Host.CallAsync("MultipleInputs", arguments);
701+
702+
// verify the correct output blob was written
703+
var blob = Fixture.TestOutputContainer.GetBlockBlobReference(id);
704+
await TestHelpers.WaitForBlobAsync(blob);
705+
string blobContent = blob.DownloadText();
706+
Assert.Equal("Test Entity 1, Test Entity 2", TestHelpers.RemoveByteOrderMark(blobContent.Trim()));
707+
}
708+
685709
[Fact]
686710
public async Task ApiHubTableEntityIn()
687711
{
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"bindings": [
3+
{
4+
"type": "manualTrigger",
5+
"name": "input",
6+
"direction": "in"
7+
},
8+
{
9+
"type": "blob",
10+
"name": "$return",
11+
"direction": "out",
12+
"path": "test-output-node/{id}"
13+
},
14+
{
15+
"type": "table",
16+
"name": "entity1",
17+
"direction": "in",
18+
"tableName": "test",
19+
"partitionKey": "AAA",
20+
"rowKey": "{rk1}"
21+
},
22+
{
23+
"type": "table",
24+
"name": "entity2",
25+
"direction": "in",
26+
"tableName": "test",
27+
"partitionKey": "AAA",
28+
"rowKey": "{rk2}"
29+
}
30+
]
31+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = function (context, input, entity1, entity2) {
2+
var result = entity1.Name + ', ' + entity2.Name;
3+
context.done(null, result);
4+
}

test/WebJobs.Script.Tests/WebJobs.Script.Tests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,9 @@
851851
<None Include="TestScripts\Node\MultipleExports\function.json">
852852
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
853853
</None>
854+
<None Include="TestScripts\Node\MultipleInputs\function.json">
855+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
856+
</None>
854857
<None Include="TestScripts\Node\MultipleOutputs\function.json">
855858
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
856859
</None>
@@ -914,6 +917,9 @@
914917
<None Include="TestScripts\Node\MultipleOutputs\index.js">
915918
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
916919
</None>
920+
<None Include="TestScripts\Node\MultipleInputs\index.js">
921+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
922+
</None>
917923
<Content Include="TestScripts\Node\NotificationHubNative\index.js">
918924
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
919925
</Content>

0 commit comments

Comments
 (0)