Skip to content

Commit e34e67e

Browse files
committed
Fix bb builder tests
1 parent 6eafa14 commit e34e67e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Modules/Tests/BBBuilderTests/BBBuilderTests.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct BBBuilderTests {
9090
let id = 0
9191
let text = String.imageAttachment(id: id)
9292
let nodes = BBBuilder.build(text: text, attachments: [.image(id: id)])
93-
let imageAttachmentAttribute = "\"\(Post.Attachment.image(id: id).id):\(Post.Attachment.image(id: 0).name)\""
93+
let imageAttachmentAttribute = "\"\(Attachment.image(id: id).id):\(Attachment.image(id: 0).name)\""
9494
#expect(nodes == [.attachment(imageAttachmentAttribute.asAttributed())])
9595
}
9696

@@ -99,8 +99,8 @@ struct BBBuilderTests {
9999
let secondId = 1
100100
let text = String.imageAttachment(id: firstId) + String.imageAttachment(id: secondId)
101101
let nodes = BBBuilder.build(text: text, attachments: [.image(id: firstId), .image(id: secondId)])
102-
let firstImageAttachmentAttribute = "\"\(Post.Attachment.image(id: firstId).id):\(Post.Attachment.image(id: firstId).name)\""
103-
let secondImageAttachmentAttribute = "\"\(Post.Attachment.image(id: secondId).id):\(Post.Attachment.image(id: secondId).name)\""
102+
let firstImageAttachmentAttribute = "\"\(Attachment.image(id: firstId).id):\(Attachment.image(id: firstId).name)\""
103+
let secondImageAttachmentAttribute = "\"\(Attachment.image(id: secondId).id):\(Attachment.image(id: secondId).name)\""
104104
#expect(nodes == [
105105
.attachment(firstImageAttachmentAttribute.asAttributed()),
106106
.attachment(secondImageAttachmentAttribute.asAttributed())
@@ -112,8 +112,8 @@ struct BBBuilderTests {
112112
let secondId = 1
113113
let text = String.imageAttachment(id: firstId) + " " + String.imageAttachment(id: secondId)
114114
let nodes = BBBuilder.build(text: text, attachments: [.image(id: firstId), .image(id: secondId)])
115-
let firstImageAttachmentAttribute = "\"\(Post.Attachment.image(id: firstId).id):\(Post.Attachment.image(id: firstId).name)\""
116-
let secondImageAttachmentAttribute = "\"\(Post.Attachment.image(id: secondId).id):\(Post.Attachment.image(id: secondId).name)\""
115+
let firstImageAttachmentAttribute = "\"\(Attachment.image(id: firstId).id):\(Attachment.image(id: firstId).name)\""
116+
let secondImageAttachmentAttribute = "\"\(Attachment.image(id: secondId).id):\(Attachment.image(id: secondId).name)\""
117117
#expect(nodes == [
118118
.attachment(firstImageAttachmentAttribute.asAttributed()),
119119
.attachment(secondImageAttachmentAttribute.asAttributed())
@@ -305,39 +305,39 @@ private func fileConstructor(_ file: File) -> String {
305305
return result
306306
}
307307

308-
private extension Post.Attachment {
309-
static func image(id: Int) -> Post.Attachment {
310-
return Post.Attachment(
308+
private extension Models.Attachment {
309+
static func image(id: Int) -> Models.Attachment {
310+
return Attachment(
311311
id: id, type: .image, name: "name.jpg", size: 0,
312-
metadata: Post.Attachment.Metadata(
312+
metadata: Attachment.Metadata(
313313
width: 32, height: 32, url: URL(string: "https://4pda.to/s/Zy0hEHci0VoolKcVH289BigH8f5BA5xRz0kvtrjCPBWYZz2rtz1.png")!
314314
),
315315
downloadCount: nil
316316
)
317317
}
318318

319-
static func file(id: Int, name: String = "name.zip", size: Int = 0, downloads: Int? = nil) -> Post.Attachment {
320-
return Post.Attachment(id: id, type: .file, name: name, size: size, metadata: nil, downloadCount: downloads)
319+
static func file(id: Int, name: String = "name.zip", size: Int = 0, downloads: Int? = nil) -> Models.Attachment {
320+
return Attachment(id: id, type: .file, name: name, size: size, metadata: nil, downloadCount: downloads)
321321
}
322322
}
323323

324324
private extension String {
325325
static func imageAttachment(id: Int) -> String {
326-
return "[attachment=\"\(Post.Attachment.image(id: id).id):\(Post.Attachment.image(id: id).name)\"]"
326+
return "[attachment=\"\(Attachment.image(id: id).id):\(Attachment.image(id: id).name)\"]"
327327
}
328328

329329
static func fileAttachment(id: Int) -> String {
330-
return "[attachment=\"\(Post.Attachment.file(id: id).id):\(Post.Attachment.file(id: id).name)\"]"
330+
return "[attachment=\"\(Attachment.file(id: id).id):\(Attachment.file(id: id).name)\"]"
331331
}
332332
}
333333

334334
private extension NSAttributedString {
335335
static func imageAttachmentAttribute(id: Int) -> NSAttributedString {
336-
return NSAttributedString(string: "\"\(Post.Attachment.image(id: id).id):\(Post.Attachment.image(id: id).name)\"")
336+
return NSAttributedString(string: "\"\(Attachment.image(id: id).id):\(Attachment.image(id: id).name)\"")
337337
}
338338

339339
static func fileAttachmentAttribute(id: Int) -> NSAttributedString {
340-
return NSAttributedString(string: "\"\(Post.Attachment.file(id: id).id):\(Post.Attachment.file(id: id).name)\"")
340+
return NSAttributedString(string: "\"\(Attachment.file(id: id).id):\(Attachment.file(id: id).name)\"")
341341
}
342342
}
343343

0 commit comments

Comments
 (0)