krz/moonrise

Night-sky companion for iPhone, Apple Watch and Vision Pro: what's up tonight, the Moon, planets, launches and missions, and a Library of the solar system. SwiftUI app with a Cloudflare Workers backend. astronomy cloudflare-workers ios night-sky space swiftui visionos watchos

Packages/MoonriseKit/Tests/FeedsTests/NewsTests.swift

16 lines · 723 bytes

1 symbol in this file
 1import Foundation
 2import Testing
 3@testable import Feeds
 4
 5@Test func decodesNewsArticles() throws {
 6    // snapi.json saved from api.spaceflightnewsapi.net/v4/articles/?limit=5 on 2026-10-18.
 7    let url = try #require(Bundle.module.url(forResource: "Fixtures/snapi", withExtension: "json"))
 8    let articles = try NewsArticle.decode(Data(contentsOf: url))
 9    #expect(articles.count == 3)
10    #expect(!articles.contains { $0.title.hasPrefix("APOD:") })
11    #expect(articles[0].id == 40426)
12    #expect(articles[0].site == "Spaceflight Now")
13    #expect(articles[0].image?.scheme == "https")
14    #expect(articles[0].published == Date(timeIntervalSince1970: 1_792_341_122))
15    #expect(!articles[0].summary.hasSuffix(" "))
16}