Skip to content

Commit d50fa7d

Browse files
author
Attila Bardos
committed
Fix broken test
1 parent 5785a00 commit d50fa7d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Tests/iOS/Specs/Storage/DiskStorageSpec.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Quick
22
import Nimble
3+
import CryptoSwift
34
@testable import Cache
45

56
class DiskStorageSpec: QuickSpec {
@@ -178,7 +179,19 @@ class DiskStorageSpec: QuickSpec {
178179

179180
describe("#fileName") {
180181
it("returns a correct file name") {
181-
expect(storage.fileName(key)).to(equal(key.base64()))
182+
if let digest = key.dataUsingEncoding(NSUTF8StringEncoding)?.md5() {
183+
var string = ""
184+
var byte: UInt8 = 0
185+
186+
for i in 0 ..< digest.length {
187+
digest.getBytes(&byte, range: NSMakeRange(i, 1))
188+
string += String(format: "%02x", byte)
189+
}
190+
191+
expect(storage.fileName(key)).to(equal(string))
192+
} else {
193+
expect(storage.fileName(key)).to(equal(key.base64()))
194+
}
182195
}
183196
}
184197

0 commit comments

Comments
 (0)