Skip to content

Commit

Permalink
Added a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveverwer committed Sep 11, 2023
1 parent a274311 commit fe3a98a
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Tests/ValidatorTests/RemoveDenyListTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import XCTest

import Foundation
@testable import ValidatorCore

final class RemoveDenyListTests: XCTestCase {

func test_processPackageDenyList() throws {
let packageList = [
"https://example.com/owner1/repo1",
"https://example.com/owner1/repo2",
"https://example.com/OWNER2/REPO1",
"https://example.com/owner2/repo2",
"https://example.com/owner2/repo3"
].map { PackageURL(rawValue: URL(string: $0)!) }

let denyList = [
"https://example.com/owner1/repo1",
"https://example.com/owner2/repo1" // Deliberately a different case
].map { PackageURL(rawValue: URL(string: $0)!) }

// MUT
let command = Validator.RemoveDenyList()
let processedList = command.processPackageDenyList(packageList: packageList, denyList: denyList)

XCTAssertEqual(processedList, [
"https://example.com/owner1/repo2",
"https://example.com/owner2/repo2",
"https://example.com/owner2/repo3"
].map { PackageURL(rawValue: URL(string: $0)!) })
}

}

0 comments on commit fe3a98a

Please sign in to comment.