@@ -80,6 +80,24 @@ describe("IOSEntitlements Service Tests", () => {
80
80
<string>production</string>
81
81
</dict>
82
82
</plist>` ;
83
+ const namedAppResourcesEntitlementsContent = `<?xml version="1.0" encoding="UTF-8"?>
84
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
85
+ <plist version="1.0">
86
+ <dict>
87
+ <key>nameKey</key>
88
+ <string>appResources</string>
89
+ </dict>
90
+ </plist>` ;
91
+ const mergedEntitlementsContent = `<?xml version="1.0" encoding="UTF-8"?>
92
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
93
+ <plist version="1.0">
94
+ <dict>
95
+ <key>aps-environment</key>
96
+ <string>production</string>
97
+ <key>nameKey</key>
98
+ <string>appResources</string>
99
+ </dict>
100
+ </plist>` ;
83
101
84
102
function assertContent ( actual : string , expected : string ) {
85
103
let strip = ( x : string ) => {
@@ -127,5 +145,29 @@ describe("IOSEntitlements Service Tests", () => {
127
145
let actual = fs . readText ( destinationFilePath ) ;
128
146
assertContent ( actual , defaultPluginEntitlementsContent ) ;
129
147
} ) ;
148
+
149
+ it ( "Merge uses App_Resources and Plugins and merges all keys" , async ( ) => {
150
+ // setup app resoruces
151
+ let appResourcesEntitlement = ( < any > iOSEntitlementsService ) . getDefaultAppEntitlementsPath ( projectData ) ;
152
+ fs . writeFile ( appResourcesEntitlement , namedAppResourcesEntitlementsContent ) ;
153
+
154
+ // setup plugin entitlements
155
+ let pluginsService = injector . resolve ( "pluginsService" ) ;
156
+ let testPluginFolderPath = temp . mkdirSync ( "testPlugin" ) ;
157
+ pluginsService . getAllInstalledPlugins = async ( ) => [ {
158
+ pluginPlatformsFolderPath : ( platform : string ) => {
159
+ return testPluginFolderPath ;
160
+ }
161
+ } ] ;
162
+ let pluginAppEntitlementsPath = path . join ( testPluginFolderPath , IOSEntitlementsService . DefaultEntitlementsName ) ;
163
+ fs . writeFile ( pluginAppEntitlementsPath , defaultPluginEntitlementsContent ) ;
164
+
165
+ // act
166
+ await iOSEntitlementsService . merge ( projectData ) ;
167
+
168
+ // assert
169
+ let actual = fs . readText ( destinationFilePath ) ;
170
+ assertContent ( actual , mergedEntitlementsContent ) ;
171
+ } ) ;
130
172
} ) ;
131
173
} ) ;
0 commit comments