Skip to content

Commit

Permalink
Fix newlines in karama adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKeen committed Sep 16, 2017
1 parent 6c30e63 commit 9943ab2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extension KarmaService {
let possibleOperation = message.text
.substring(from: link.range.upperBound)
.trimCharacters(in: [" ", ">", ":"])
.components(separatedBy: " ")
.components(seperatedBy: [" ", "\n"])
.first ?? ""

guard let operation = Operation(rawValue: possibleOperation)
Expand Down
4 changes: 4 additions & 0 deletions Tests/CamilleTests/KarmaService+AdjustmentsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ class KarmaService_AdjustmentsTests: XCTestCase {

(ModelIDs.mockUser2, "<@\(ModelIDs.mockUser1)>++", 1),
(ModelIDs.mockUser2, "<@\(ModelIDs.mockUser1)> ++", 1),
(ModelIDs.mockUser2, "<@\(ModelIDs.mockUser1)>++\n", 1),
(ModelIDs.mockUser2, "\n<@\(ModelIDs.mockUser1)>++", 1),

(ModelIDs.mockUser2, "<@\(ModelIDs.mockUser1)>++ <@\(ModelIDs.mockUser1)>++", 2),
(ModelIDs.mockUser2, "<@\(ModelIDs.mockUser1)>++\n<@\(ModelIDs.mockUser1)>++", 2),
(ModelIDs.mockUser2, "\n<@\(ModelIDs.mockUser1)>++\n\n<@\(ModelIDs.mockUser1)>++\n", 2),
]

for (sender, text, change) in adjustments {
Expand Down

0 comments on commit 9943ab2

Please sign in to comment.