1#import "EXEnvironment.h"
2#import "EXEnvironment+Tests.h"
3#import "EXEnvironmentMocks.h"
4
5@implementation EXEnvironmentMocks
6
7#pragma mark - mock environment presets
8
9+ (void)loadExpoClientConfig
10{
11  [[EXEnvironment sharedEnvironment] _loadShellConfig:@{}
12                                      withInfoPlist:[EXEnvironmentMocks _expoClientInfoPlist]
13                                  withExpoKitDevUrl:nil
14                               withEmbeddedManifest:[EXEnvironmentMocks embeddedManifest]
15                                         isDetached:NO
16                                 isDebugXCodeScheme:NO
17                                       isUserDetach:NO];
18}
19
20+ (void)loadProdServiceConfig
21{
22  [[EXEnvironment sharedEnvironment] _loadShellConfig:[EXEnvironmentMocks shellConfig]
23                    withInfoPlist:[EXEnvironmentMocks infoPlist]
24                withExpoKitDevUrl:nil
25             withEmbeddedManifest:[EXEnvironmentMocks embeddedManifest]
26                       isDetached:YES
27               isDebugXCodeScheme:NO
28                     isUserDetach:NO];
29}
30
31+ (void)loadDevDetachConfig
32{
33  [[EXEnvironment sharedEnvironment] _loadShellConfig:[EXEnvironmentMocks shellConfig]
34                    withInfoPlist:[EXEnvironmentMocks infoPlist]
35                withExpoKitDevUrl:[EXEnvironmentMocks expoKitDevUrl]
36             withEmbeddedManifest:[EXEnvironmentMocks embeddedManifest]
37                       isDetached:YES
38               isDebugXCodeScheme:YES
39                     isUserDetach:YES];
40}
41
42#pragma mark - mock config data
43
44+ (NSMutableDictionary *)shellConfig
45{
46  return [@{
47    @"manifestUrl": @"https://exp.host/@community/native-component-list",
48  } mutableCopy];
49}
50
51+ (NSString *)prodUrlScheme
52{
53  return @"ncl";
54}
55
56+ (NSString *)expoKitDevUrl
57{
58  return [NSString stringWithFormat:@"%@://%@", [self prodUrlScheme], @"localhost:19000"];
59}
60
61+ (NSMutableDictionary *)infoPlist
62{
63  return [@{
64    @"CFBundleURLTypes": @[
65      @{
66        @"CFBundleURLSchemes": @[
67          [self prodUrlScheme],
68        ],
69      },
70    ],
71  } mutableCopy];
72}
73
74+ (NSDictionary *)embeddedManifest
75{
76  return @{
77   @"bundleUrl": @"https://classic-assets.eascdn.net/%40community%2Fnative-component-list%2F25.1.0%2Fdbe753ef7122562ed798ee55cfa489ed-25.0.0-ios.js"
78  };
79}
80
81+ (NSMutableDictionary *)_expoClientInfoPlist
82{
83  return [@{
84    @"CFBundleURLTypes": @[
85      @{
86        @"CFBundleURLSchemes": @[ @"exp", @"exps" ],
87      },
88    ],
89  } mutableCopy];
90}
91
92 @end
93