Skip to content

Commit

Permalink
Merge branch 'dev' into 310-privacy-info
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelacaron committed Oct 11, 2024
2 parents 2187a5e + a31ee3b commit ccb6157
Show file tree
Hide file tree
Showing 83 changed files with 560 additions and 943 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ concurrency:

jobs:
build:
runs-on: macos-13
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
xcode-version: latest-stable
- name: Setup Config file
run: |
cp Basic-Car-Maintenance.xcconfig.template Basic-Car-Maintenance.xcconfig
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ jobs:
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Install packages
run: xcodebuild -resolvePackageDependencies

- name: Enable Build Tools
run: cp fastlane/enable-build-tool-plugins.json ~/Library/org.swift.swiftpm/security/plugins.json

- name: Update dependencies
- name: Install dependencies
run: bundle install

- name: Install build log formatter
run: brew install xcbeautify

- name: Run Unit Tests
run: bundle exec fastlane unit_tests
run: FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT=60 bundle exec fastlane unit_tests
42 changes: 40 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,54 @@ disabled_rules: # rule identifiers turned on by default to exclude from running
- empty_parentheses_with_trailing_closure
opt_in_rules: # some rules are turned off by default, so you need to opt-in
- closure_parameter_position
- closing_brace
- comma
- closure_spacing
- collection_alignment
- colon
- comma
- compiler_protocol_init
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- control_statement
- convenience_type
- cyclomatic_complexity
- duplicate_imports
- dynamic_inline
- empty_collection_literal
- empty_count
- empty_enum_arguments
- empty_parameters
- empty_parentheses_with_trailing_closure
- empty_xctest_method
- explicit_init
- for_where
- force_try
- leading_whitespace
- local_doc_comment
- lower_acl_than_parent
- nslocalizedstring_key
- opening_brace
- operator_usage_whitespace
- operator_whitespace
- overridden_super_call
- period_spacing
- private_over_fileprivate
- private_swiftui_state
- syntactic_sugar
- test_case_accessibility
- trailing_comma
- trailing_newline
- trailing_semicolon
- unavailable_function
- unused_closure_parameter
- unused_control_flow_label
- unused_enumerated
- unused_optional_binding
- unused_setter_value
- weak_delegate
- xctfail_message
- yoda_condition

# Alternatively, specify all rules explicitly by uncommenting this option:
# only_rules: # delete `disabled_rules` & `opt_in_rules` if using this
Expand Down
95 changes: 49 additions & 46 deletions Basic-Car-Maintenance-Tests/Shared/Models/ContributorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,69 @@
// ContributorTests.swift
// Basic-Car-Maintenance-Tests
//
// Created by Drag0ndust on 07.10.23.
// https://github.com/mikaelacaron/Basic-Car-Maintenance
// See LICENSE for license information.
//

import XCTest
import Foundation
import Testing
@testable import Basic_Car_Maintenance

final class ContributorTests: XCTestCase {
private var jsonDecoder: JSONDecoder!
private var jsonEncoder: JSONEncoder!
private let testContributorJson = """
{
"login": "Drag0ndust",
"id": 12915108,
"node_id": "MDQ6VXNlcjEyOTE1MTA4",
"avatar_url": "https://avatars.githubusercontent.com/u/12915108?v=4",
"url": "https://api.github.com/users/Drag0ndust",
"html_url": "https://github.com/Drag0ndust",
"contributions": 0
}
"""

override func setUpWithError() throws {
jsonDecoder = JSONDecoder()
struct ContributorTests {
private let jsonDecoder = {
let jsonDecoder = JSONDecoder()
jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase

jsonEncoder = JSONEncoder()
return jsonDecoder
}()

private let jsonEncoder = {
let jsonEncoder = JSONEncoder()
jsonEncoder.keyEncodingStrategy = .convertToSnakeCase
return jsonEncoder
}()

@Test()
func contributorDecoding() throws {
let testContributorJson = """
{
"login": "Drag0ndust",
"id": 12915108,
"node_id": "MDQ6VXNlcjEyOTE1MTA4",
"avatar_url": "https://avatars.githubusercontent.com/u/12915108?v=4",
"url": "https://api.github.com/users/Drag0ndust",
"html_url": "https://github.com/Drag0ndust",
"contributions": 0
}

func testContributorDecoding() throws {
guard let data = testContributorJson.data(using: .utf8) else {
XCTFail("Can't decode JSON string")
return
}

"""
let data = try #require(testContributorJson.data(using: .utf8))
let sut = try jsonDecoder.decode(Contributor.self, from: data)

XCTAssertEqual(sut.login, "Drag0ndust")
XCTAssertEqual(sut.id, 12915108)
XCTAssertEqual(sut.nodeID, "MDQ6VXNlcjEyOTE1MTA4")
XCTAssertEqual(sut.avatarURL, "https://avatars.githubusercontent.com/u/12915108?v=4")
XCTAssertEqual(sut.url, "https://api.github.com/users/Drag0ndust")
XCTAssertEqual(sut.htmlURL, "https://github.com/Drag0ndust")
XCTAssertEqual(sut.contributions, 0)
#expect(sut.login == "Drag0ndust")
#expect(sut.id == 12915108)
#expect(sut.nodeID == "MDQ6VXNlcjEyOTE1MTA4")
#expect(sut.avatarURL == "https://avatars.githubusercontent.com/u/12915108?v=4")
#expect(sut.url == "https://api.github.com/users/Drag0ndust")
#expect(sut.htmlURL == "https://github.com/Drag0ndust")
#expect(sut.contributions == 0)
}

func testContributorEncoding() throws {
let contributor = Contributor(login: "Drag0ndust",
id: 12915108,
nodeID: "MDQ6VXNlcjEyOTE1MTA4",
avatarURL: "https://avatars.githubusercontent.com/u/12915108?v=4",
url: "https://api.github.com/users/Drag0ndust",
htmlURL: "https://github.com/Drag0ndust",
contributions: 0)
@Test()
func contributorEncoding() throws {
let contributor = Contributor(
login: "Drag0ndust",
id: 12915108,
nodeID: "MDQ6VXNlcjEyOTE1MTA4",
avatarURL: "https://avatars.githubusercontent.com/u/12915108?v=4",
url: "https://api.github.com/users/Drag0ndust",
htmlURL: "https://github.com/Drag0ndust",
contributions: 0
)

let contributorData = try jsonEncoder.encode(contributor)

// now decode it again and check if the objects are equal
// now decode it again and check if the objects are equal
let decodedContributor = try jsonDecoder.decode(Contributor.self, from: contributorData)

XCTAssertEqual(contributor, decodedContributor)
#expect(contributor == decodedContributor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
// Basic_Car_Maintenance-UITests.swift
// Basic-Car-Maintenance-UITests
//
// Created by Mikaela Caron on 8/11/23.
// https://github.com/mikaelacaron/Basic-Car-Maintenance
// See LICENSE for license information.
//

import XCTest

final class BasicCarMaintenanceUITests: XCTestCase {

let app = XCUIApplication()
private let app = XCUIApplication()

override func setUp() {
continueAfterFailure = false
Expand Down
3 changes: 2 additions & 1 deletion Basic-Car-Maintenance-Widget/AppIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// AppIntent.swift
// Basic-Car-Maintenance-Widget
//
// Created by Mikaela Caron on 10/4/23.
// https://github.com/mikaelacaron/Basic-Car-Maintenance
// See LICENSE for license information.
//

import WidgetKit
Expand Down
3 changes: 2 additions & 1 deletion Basic-Car-Maintenance-Widget/BasicCarMaintenanceWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Basic-Car-Maintenance-Widget.swift
// Basic-Car-Maintenance-Widget
//
// Created by Mikaela Caron on 10/4/23.
// https://github.com/mikaelacaron/Basic-Car-Maintenance
// See LICENSE for license information.
//

import WidgetKit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// BasicCarMaintenanceWidgetBundle.swift
// Basic-Car-Maintenance-Widget
//
// Created by Mikaela Caron on 10/4/23.
// https://github.com/mikaelacaron/Basic-Car-Maintenance
// See LICENSE for license information.
//

import WidgetKit
Expand Down
Loading

0 comments on commit ccb6157

Please sign in to comment.