Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
k-kohey committed Nov 10, 2022
1 parent 3abfd96 commit af97252
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions Sources/ParchmentDefault/DeviceDataMutation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
import UIKit

public struct DeviceDataMutation: Mutation {
private let deviceParams = [
"Model": UIDevice.current.name,
"OS": UIDevice.current.systemName,
"OS Version": UIDevice.current.systemVersion
]
private let deviceParams: [String: Any]

@MainActor
public init(device: UIDevice) {
deviceParams = [
"Model": device.name,
"OS": device.systemName,
"OS Version": device.systemVersion
]
}

public func transform(_ event: any Loggable, id _: LoggerComponentID) -> any Loggable {
let log: LoggableDictonary = [
Expand Down
4 changes: 2 additions & 2 deletions Tests/ParchmentDefaultTests/MutationTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ private enum Event: Loggable {

class MutationTests: XCTestCase {
// 的確なテストに直す
func testTransform() throws {
@MainActor func testTransform() throws {
let event = Event.hoge
let mutation: [Mutation] = [DeviceDataMutation()]
let mutation: [Mutation] = [DeviceDataMutation(device: .current)]

let newEvent = mutation.transform(event, id: .init("hoge"))

Expand Down

0 comments on commit af97252

Please sign in to comment.