Skip to content

Commit 3b23c34

Browse files
author
Christian Elies
committed
test(): implemented url session + remote image url data publisher test
1 parent 36eb792 commit 3b23c34

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// URLSession+RemoteImageURLDataPublisherTests.swift
3+
// RemoteImageTests
4+
//
5+
// Created by Christian Elies on 15.12.19.
6+
//
7+
8+
import Foundation
9+
@testable import RemoteImage
10+
import XCTest
11+
12+
final class URLSession_RemoteImageURLDataPublisherTests: XCTestCase {
13+
func testDataPublisher() {
14+
guard let url = URL(string: "https://google.de") else {
15+
XCTFail("Could not create mock URL")
16+
return
17+
}
18+
let urlSession: URLSession = .shared
19+
let urlRequest = URLRequest(url: url)
20+
let dataTaskPublisher = urlSession.dataTaskPublisher(for: urlRequest).eraseToAnyPublisher()
21+
let dataPublisher = urlSession.dataPublisher(for: urlRequest)
22+
XCTAssertEqual(dataPublisher.description, dataTaskPublisher.description)
23+
}
24+
}

0 commit comments

Comments
 (0)