@@ -63,4 +63,49 @@ final class RegistrationEncodingTests: XCTestCase {
63
63
let reencoded = try decoder. decode ( Registration . self, from: data)
64
64
XCTAssertEqual ( registration, reencoded)
65
65
}
66
+
67
+ func testAssembly( ) throws {
68
+ let assembly = Configuration (
69
+ assemblyName: " MainAssembly " ,
70
+ moduleName: " MyModule " ,
71
+ registrations: [ . init( service: " ServiceA " ) ] ,
72
+ targetResolver: " Resolver "
73
+ )
74
+
75
+ let encoder = JSONEncoder ( )
76
+ encoder. outputFormatting = [ . prettyPrinted, . sortedKeys]
77
+ let data = try encoder. encode ( assembly)
78
+ let text = try XCTUnwrap ( String ( data: data, encoding: . utf8) )
79
+ let expected = """
80
+ {
81
+ " assemblyName " : " MainAssembly " ,
82
+ " assemblyType " : " ModuleAssembly " ,
83
+ " directives " : {
84
+ " custom " : [
85
+
86
+ ],
87
+ " disablePerformanceGen " : false
88
+ },
89
+ " registrations " : [
90
+ {
91
+ " accessLevel " : " internal " ,
92
+ " arguments " : [
93
+
94
+ ],
95
+ " customTags " : [
96
+
97
+ ],
98
+ " functionName " : " register " ,
99
+ " service " : " ServiceA "
100
+ }
101
+ ],
102
+ " replaces " : [
103
+
104
+ ],
105
+ " targetResolver " : " Resolver "
106
+ }
107
+ """
108
+
109
+ XCTAssertEqual ( text, expected)
110
+ }
66
111
}
0 commit comments