|
1 | 1 | import { BundleIdCapability } from '@expo/apple-utils';
|
2 | 2 |
|
3 |
| -import { |
4 |
| - CapabilityMapping, |
5 |
| - assertValidOptions, |
6 |
| - syncCapabilitiesForEntitlementsAsync, |
7 |
| -} from '../bundleIdCapabilities'; |
| 3 | +import { assertValidOptions, syncCapabilitiesForEntitlementsAsync } from '../bundleIdCapabilities'; |
| 4 | +import { CapabilityMapping } from '../capabilityList'; |
8 | 5 |
|
9 | 6 | const broadcastNotificationOption = {
|
10 | 7 | usesBroadcastPushNotifications: false,
|
@@ -291,6 +288,39 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
291 | 288 | { capabilityType: 'ACCESS_WIFI_INFORMATION', option: 'OFF' },
|
292 | 289 | ]);
|
293 | 290 | });
|
| 291 | + |
| 292 | + it('given a bundleId with a capability that is enabled, and the entitlement is set to true, the capability is skipped', async () => { |
| 293 | + const ctx = { providerId: 123195, teamId: 'MyteamId' }; |
| 294 | + const remote = { |
| 295 | + id: 'UFJ54VZ75A_ACCESS_WIFI_INFORMATION', |
| 296 | + attributes: { |
| 297 | + ownerType: 'BUNDLE', |
| 298 | + settings: null, |
| 299 | + editable: true, |
| 300 | + inputs: null, |
| 301 | + enabled: true, |
| 302 | + responseId: '31746b7d-4728-49f5-a8f9-a81c0cecabb1', |
| 303 | + }, |
| 304 | + }; |
| 305 | + |
| 306 | + const capability = new BundleIdCapability(ctx, remote.id, remote.attributes as any); |
| 307 | + const bundleId = { |
| 308 | + getBundleIdCapabilitiesAsync: jest.fn(() => [capability]), |
| 309 | + updateBundleIdCapabilityAsync: jest.fn(), |
| 310 | + id: 'UFJ54VZ75A', |
| 311 | + } as any; |
| 312 | + const { enabled, disabled } = await syncCapabilitiesForEntitlementsAsync( |
| 313 | + bundleId, |
| 314 | + { |
| 315 | + 'com.apple.developer.networking.wifi-info': true, |
| 316 | + }, |
| 317 | + broadcastNotificationOption |
| 318 | + ); |
| 319 | + |
| 320 | + expect(enabled).toStrictEqual([]); |
| 321 | + expect(disabled).toStrictEqual([]); |
| 322 | + expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled(); |
| 323 | + }); |
294 | 324 | });
|
295 | 325 |
|
296 | 326 | it('enables all capabilities', async () => {
|
|
0 commit comments