File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ @testable import Functions
2+ import XCTest
3+
4+ final class FunctionInvokeOptionsTests : XCTestCase {
5+ func testStringBody( ) {
6+ let options = FunctionInvokeOptions ( body: " string value " )
7+ XCTAssertEqual ( options. headers [ " Content-Type " ] , " text/plain " )
8+ XCTAssertNotNil ( options. body)
9+ }
10+
11+ func testDataBody( ) {
12+ let options = FunctionInvokeOptions ( body: " binary value " . data ( using: . utf8) !)
13+ XCTAssertEqual ( options. headers [ " Content-Type " ] , " application/octet-stream " )
14+ XCTAssertNotNil ( options. body)
15+ }
16+
17+ func testEncodableBody( ) {
18+ struct Body : Encodable {
19+ let value : String
20+ }
21+ let options = FunctionInvokeOptions ( body: Body ( value: " value " ) )
22+ XCTAssertEqual ( options. headers [ " Content-Type " ] , " application/json " )
23+ XCTAssertNotNil ( options. body)
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments