Skip to content

Commit ded3397

Browse files
committed
chore: cleanup tests
1 parent 6acbdf7 commit ded3397

File tree

3 files changed

+0
-191
lines changed

3 files changed

+0
-191
lines changed

BatchExtension.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
5141F8EA258A6CB300170375 /* SharedDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5141F8DE258A211900170375 /* SharedDefaultsTests.swift */; };
1110
514E86CE2362EBEC00E42FF4 /* Consts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 514E86C82362EBEC00E42FF4 /* Consts.swift */; };
1211
514E86CF2362EBEC00E42FF4 /* RichNotificationHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 514E86CA2362EBEC00E42FF4 /* RichNotificationHelper.swift */; };
1312
514E86D02362EBEC00E42FF4 /* BAENotificationServiceExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 514E86CC2362EBEC00E42FF4 /* BAENotificationServiceExtension.m */; };
@@ -30,7 +29,6 @@
3029
/* End PBXContainerItemProxy section */
3130

3231
/* Begin PBXFileReference section */
33-
5141F8DE258A211900170375 /* SharedDefaultsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedDefaultsTests.swift; sourceTree = "<group>"; };
3432
514E86C82362EBEC00E42FF4 /* Consts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Consts.swift; sourceTree = "<group>"; };
3533
514E86CA2362EBEC00E42FF4 /* RichNotificationHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RichNotificationHelper.swift; sourceTree = "<group>"; };
3634
514E86CC2362EBEC00E42FF4 /* BAENotificationServiceExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BAENotificationServiceExtension.m; sourceTree = "<group>"; };
@@ -134,7 +132,6 @@
134132
children = (
135133
51F7ED00236092FF00E01CD2 /* BatchExtensionTests.swift */,
136134
51F7ED02236092FF00E01CD2 /* Info.plist */,
137-
5141F8DE258A211900170375 /* SharedDefaultsTests.swift */,
138135
);
139136
path = Tests;
140137
sourceTree = "<group>";
@@ -261,7 +258,6 @@
261258
isa = PBXSourcesBuildPhase;
262259
buildActionMask = 2147483647;
263260
files = (
264-
5141F8EA258A6CB300170375 /* SharedDefaultsTests.swift in Sources */,
265261
51F7ED01236092FF00E01CD2 /* BatchExtensionTests.swift in Sources */,
266262
);
267263
runOnlyForDeploymentPostprocessing = 0;

Tests/BatchExtensionTests.swift

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -75,146 +75,4 @@ class BatchExtensionTests: XCTestCase {
7575
XCTAssertThrowsError(try RichNotificationHelper().attachment(forPayload: payload))
7676
}
7777
}
78-
79-
func testDisplayReceiptExtraction() {
80-
81-
let invalidPayload: [AnyHashable: Any] = [:]
82-
let invalidReceipt = try? DisplayReceiptHelper().displayReceipt(fromPayload: invalidPayload)
83-
XCTAssertNil(invalidReceipt)
84-
85-
let validPayload: [AnyHashable: Any] = [
86-
"com.batch": ["r":["m":1]]
87-
]
88-
89-
let receipt = try! DisplayReceiptHelper().displayReceipt(fromPayload: validPayload)
90-
XCTAssertFalse(receipt.replay)
91-
XCTAssertEqual(receipt.sendAttempt, 0)
92-
XCTAssertTrue(receipt.od == nil || receipt.od!.isEmpty)
93-
XCTAssertTrue(receipt.ed == nil || receipt.ed!.isEmpty)
94-
95-
let validPayload2: [AnyHashable: Any] = [
96-
"com.batch": ["r":["m":2]]
97-
]
98-
99-
let receipt2 = try! DisplayReceiptHelper().displayReceipt(fromPayload: validPayload2)
100-
XCTAssertFalse(receipt2.replay)
101-
XCTAssertEqual(receipt2.sendAttempt, 0)
102-
XCTAssertTrue(receipt.od == nil || receipt.od!.isEmpty)
103-
XCTAssertTrue(receipt.ed == nil || receipt.ed!.isEmpty)
104-
}
105-
106-
func testDisplayReceiptOpenDataExtraction() {
107-
108-
let od: [AnyHashable: Any] = [
109-
"sef": "toto", "bool": true, "hip": "hop"
110-
]
111-
112-
let validPayload: [AnyHashable: Any] = [
113-
"com.batch": ["r":["m":1], "od": od]
114-
]
115-
116-
let receipt = try! DisplayReceiptHelper().displayReceipt(fromPayload: validPayload)
117-
XCTAssertFalse(receipt.replay)
118-
XCTAssertEqual(receipt.sendAttempt, 0)
119-
XCTAssert(NSDictionary(dictionary: od).isEqual(to: receipt.od!));
120-
XCTAssertTrue(receipt.ed == nil || receipt.ed!.isEmpty)
121-
}
122-
123-
func testDisplayReceiptEventDataExtraction() {
124-
let validPayload: [AnyHashable: Any] = [
125-
"com.batch": ["r":["m":1], "i": "test-i", "ex": "test-ex", "va": "test-va"]
126-
]
127-
128-
let ed: [AnyHashable: Any] = [
129-
"i": "test-i", "ex": "test-ex", "va": "test-va"
130-
]
131-
132-
let receipt = try! DisplayReceiptHelper().displayReceipt(fromPayload: validPayload)
133-
XCTAssertFalse(receipt.replay)
134-
XCTAssertEqual(receipt.sendAttempt, 0)
135-
XCTAssertTrue(receipt.od == nil || receipt.od!.isEmpty)
136-
XCTAssert(NSDictionary(dictionary: ed).isEqual(to: receipt.ed!));
137-
}
138-
139-
func testReceiptPackUnpack() throws {
140-
141-
let nestedList = [
142-
false,
143-
"yolo",
144-
25.69745,
145-
654,
146-
nil
147-
] as [Any?]
148-
149-
let nestedOd = [
150-
"bool": false,
151-
"int": 654,
152-
"float": 64.285,
153-
"list": nestedList,
154-
"null": nil
155-
] as [AnyHashable : Any?]
156-
157-
let od = [
158-
"n": "je-suis-un-n",
159-
"t": "je-suis-un-c",
160-
"ak": "je-suis-un-ak",
161-
"di": "je-suis-un-di",
162-
"map": nestedOd,
163-
"list": nestedList,
164-
"bool_true": true,
165-
"bool_false": false
166-
] as [AnyHashable : Any]
167-
168-
let ed = [
169-
"i": "je-suis-un-i",
170-
"e": "je-suis-un-e",
171-
"v": "je-suis-un-v"
172-
]
173-
174-
let receipt = DisplayReceipt(timestamp: 123456, replay: false, sendAttempt: 19, od: od, ed: ed)
175-
XCTAssertNotNil(receipt)
176-
177-
let packedData = try receipt.pack()
178-
XCTAssertNotNil(packedData);
179-
180-
let unpackReceipt = try DisplayReceipt.unpack(from: packedData)
181-
XCTAssertNotNil(unpackReceipt);
182-
183-
XCTAssertEqual(unpackReceipt.timestamp, 123456);
184-
XCTAssertEqual(unpackReceipt.replay, false);
185-
XCTAssertEqual(unpackReceipt.sendAttempt, 19);
186-
XCTAssert(NSDictionary(dictionary: od).isEqual(to: unpackReceipt.od!));
187-
XCTAssert(NSDictionary(dictionary: ed).isEqual(to: unpackReceipt.ed!));
188-
}
189-
190-
func testReceiptPackEmptyMap() throws {
191-
let emptyDictionary = [AnyHashable: Any?]()
192-
let receipt = DisplayReceipt(timestamp: 65481651581, replay: true, sendAttempt: 6585, od: emptyDictionary, ed: emptyDictionary)
193-
XCTAssertNotNil(receipt)
194-
195-
let packedData = try receipt.pack()
196-
XCTAssertNotNil(packedData);
197-
198-
XCTAssertEqual("cf0000000f3f02b57dc3cd19b9c0c0", packedData.hexString());
199-
}
200-
201-
func testReceiptPackNil() throws {
202-
let receipt = DisplayReceipt(timestamp: 65481651581, replay: true, sendAttempt: 6585, od: nil, ed: nil)
203-
XCTAssertNotNil(receipt)
204-
205-
let packedData = try receipt.pack()
206-
XCTAssertNotNil(packedData);
207-
208-
XCTAssertEqual("cf0000000f3f02b57dc3cd19b9c0c0", packedData.hexString());
209-
}
210-
211-
func testReceiptUnpackNil() throws {
212-
213-
let packedData = Data(hexString: "cf0000000f3f02b57dc3cd19b9c0c0")
214-
let unpackedReceipt = try DisplayReceipt.unpack(from: packedData!)
215-
XCTAssertNotNil(unpackedReceipt)
216-
217-
XCTAssertNil(unpackedReceipt.od);
218-
XCTAssertNil(unpackedReceipt.ed);
219-
}
22078
}

Tests/SharedDefaultsTests.swift

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)