mas/Tests/masTests/Models/SearchResultListSpec.swift

38 lines
1,001 B
Swift
Raw Normal View History

2020-09-06 14:21:28 -06:00
//
// SearchResultListSpec.swift
// masTests
2020-09-06 14:21:28 -06:00
//
// Created by Ben Chatelain on 9/2/20.
// Copyright © 2020 mas-cli. All rights reserved.
//
2021-04-26 16:44:17 -07:00
import Foundation
2020-09-06 14:21:28 -06:00
import Nimble
2021-03-21 22:25:18 -07:00
import Quick
@testable import mas
2020-09-06 14:21:28 -06:00
2021-05-08 15:49:32 -07:00
public class SearchResultListSpec: QuickSpec {
override public static func spec() {
2021-04-23 00:01:18 -07:00
beforeSuite {
Mas.initialize()
2021-04-23 00:01:18 -07:00
}
2020-09-06 14:21:28 -06:00
describe("search result list") {
it("can parse bbedit") {
let data = Data(from: "search/bbedit.json")
let decoder = JSONDecoder()
let results = try decoder.decode(SearchResultList.self, from: data)
2020-09-06 14:21:28 -06:00
expect(results.resultCount) == 1
}
it("can parse things") {
let data = Data(from: "search/things.json")
let decoder = JSONDecoder()
let results = try decoder.decode(SearchResultList.self, from: data)
expect(results.resultCount) == 50
}
2020-09-06 14:21:28 -06:00
}
}
}