2020-09-06 14:21:28 -06:00
|
|
|
//
|
|
|
|
// SearchResultListSpec.swift
|
2024-10-01 14:05:41 -04:00
|
|
|
// 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
|
|
|
|
|
2024-10-01 14:05:41 -04:00
|
|
|
@testable import mas
|
2020-09-06 14:21:28 -06:00
|
|
|
|
2021-05-08 15:49:32 -07:00
|
|
|
public class SearchResultListSpec: QuickSpec {
|
2024-10-02 06:24:02 -04:00
|
|
|
override public static func spec() {
|
2021-04-23 00:01:18 -07:00
|
|
|
beforeSuite {
|
2024-10-01 14:05:41 -04:00
|
|
|
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()
|
2020-09-06 22:23:09 -06:00
|
|
|
let results = try decoder.decode(SearchResultList.self, from: data)
|
2020-09-06 14:21:28 -06:00
|
|
|
|
|
|
|
expect(results.resultCount) == 1
|
|
|
|
}
|
2020-09-06 14:56:28 -06:00
|
|
|
it("can parse things") {
|
|
|
|
let data = Data(from: "search/things.json")
|
|
|
|
let decoder = JSONDecoder()
|
2020-09-06 22:23:09 -06:00
|
|
|
let results = try decoder.decode(SearchResultList.self, from: data)
|
2020-09-06 14:56:28 -06:00
|
|
|
|
|
|
|
expect(results.resultCount) == 50
|
|
|
|
}
|
2020-09-06 14:21:28 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|