//
// HTMLLinkTests.swift
// RSParser
//
// Created by Brent Simmons on 6/25/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
//
import Foundation
import Testing
import RSParser
@Suite struct HTMLLinkTests {
@Test func sixColorsLink() {
let d = parserData("sixcolors", "html", "http://sixcolors.com/")
let links = HTMLLinkParser.htmlLinks(with: d)
let linkToFind = "https://www.theincomparable.com/theincomparable/290/index.php"
let textToFind = "this week’s episode of The Incomparable"
var found = false
for oneLink in links {
if let urlString = oneLink.urlString, let text = oneLink.text, urlString == linkToFind, text == textToFind {
found = true
}
}
#expect(found)
#expect(links.count == 131)
}
// MARK: - Inline fixture tests
@Test func linksInsideScriptAreIgnored() {
// The scanner enters raw-text mode for
real 2