Skip to content

Commit ded8478

Browse files
committed
Replace raw JSON with makeSymbolGraph() helper
Use makeSymbolGraph() helper instead of raw JSON strings for cleaner and more maintainable test code, as suggested in PR review.
1 parent 665321f commit ded8478

File tree

1 file changed

+2
-100
lines changed

1 file changed

+2
-100
lines changed

Tests/SwiftDocCTests/Infrastructure/DocumentationContext/DocumentationContext+RootPageTests.swift

Lines changed: 2 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -267,108 +267,10 @@ class DocumentationContext_RootPageTests: XCTestCase {
267267
let (_, context) = try await loadBundle(catalog:
268268
Folder(name: "multiple-modules.docc", content: [
269269
// First module symbol graph
270-
TextFile(name: "ModuleA.symbols.json", utf8Content: """
271-
{
272-
"metadata": {
273-
"formatVersion": {
274-
"major": 1,
275-
"minor": 0,
276-
"patch": 0
277-
},
278-
"generator": "unit-test"
279-
},
280-
"module": {
281-
"name": "ModuleA",
282-
"platform": {
283-
"architecture": "x86_64",
284-
"vendor": "apple",
285-
"operatingSystem": {
286-
"name": "macosx",
287-
"minimumVersion": {
288-
"major": 10,
289-
"minor": 15
290-
}
291-
},
292-
"environment": null
293-
}
294-
},
295-
"symbols": [
296-
{
297-
"identifier": {
298-
"precise": "ModuleA",
299-
"interfaceLanguage": "swift"
300-
},
301-
"names": {
302-
"title": "ModuleA",
303-
"navigator": null,
304-
"subHeading": null,
305-
"prose": null
306-
},
307-
"pathComponents": ["ModuleA"],
308-
"docComment": null,
309-
"accessLevel": "public",
310-
"kind": {
311-
"identifier": "module",
312-
"displayName": "Module"
313-
},
314-
"mixins": {}
315-
}
316-
],
317-
"relationships": []
318-
}
319-
"""),
270+
JSONFile(name: "ModuleA.symbols.json", content: makeSymbolGraph(moduleName: "ModuleA")),
320271

321272
// Second module symbol graph
322-
TextFile(name: "ModuleB.symbols.json", utf8Content: """
323-
{
324-
"metadata": {
325-
"formatVersion": {
326-
"major": 1,
327-
"minor": 0,
328-
"patch": 0
329-
},
330-
"generator": "unit-test"
331-
},
332-
"module": {
333-
"name": "ModuleB",
334-
"platform": {
335-
"architecture": "x86_64",
336-
"vendor": "apple",
337-
"operatingSystem": {
338-
"name": "macosx",
339-
"minimumVersion": {
340-
"major": 10,
341-
"minor": 15
342-
}
343-
},
344-
"environment": null
345-
}
346-
},
347-
"symbols": [
348-
{
349-
"identifier": {
350-
"precise": "ModuleB",
351-
"interfaceLanguage": "swift"
352-
},
353-
"names": {
354-
"title": "ModuleB",
355-
"navigator": null,
356-
"subHeading": null,
357-
"prose": null
358-
},
359-
"pathComponents": ["ModuleB"],
360-
"docComment": null,
361-
"accessLevel": "public",
362-
"kind": {
363-
"identifier": "module",
364-
"displayName": "Module"
365-
},
366-
"mixins": {}
367-
}
368-
],
369-
"relationships": []
370-
}
371-
"""),
273+
JSONFile(name: "ModuleB.symbols.json", content: makeSymbolGraph(moduleName: "ModuleB")),
372274

373275
InfoPlist(displayName: "TestBundle", identifier: "com.test.example"),
374276
])

0 commit comments

Comments
 (0)