mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
3 years ago
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
import Quick
|
||
|
import Nimble
|
||
|
|
||
10 months ago
|
@testable import SessionSnodeKit
|
||
3 years ago
|
|
||
|
class FileUploadResponseSpec: QuickSpec {
|
||
2 years ago
|
override class func spec() {
|
||
|
// MARK: - a FileUploadResponse
|
||
3 years ago
|
describe("a FileUploadResponse") {
|
||
2 years ago
|
// MARK: -- when decoding
|
||
3 years ago
|
context("when decoding") {
|
||
2 years ago
|
// MARK: ---- handles a string id value
|
||
3 years ago
|
it("handles a string id value") {
|
||
|
let jsonData: Data = "{\"id\":\"123\"}".data(using: .utf8)!
|
||
|
let response: FileUploadResponse? = try? JSONDecoder().decode(FileUploadResponse.self, from: jsonData)
|
||
|
|
||
|
expect(response?.id).to(equal("123"))
|
||
|
}
|
||
|
|
||
2 years ago
|
// MARK: ---- handles an int id value
|
||
3 years ago
|
it("handles an int id value") {
|
||
|
let jsonData: Data = "{\"id\":124}".data(using: .utf8)!
|
||
|
let response: FileUploadResponse? = try? JSONDecoder().decode(FileUploadResponse.self, from: jsonData)
|
||
|
|
||
|
expect(response?.id).to(equal("124"))
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|