Files
MapLibreParticleLab/platform/ios/Integration_Tests/MLNIntegrationTestCase.m
mwilsnd 20d9e1028c Platform flattening overhaul (#1393)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <bart@emeel.net>
2023-07-26 17:50:34 +02:00

56 lines
1.6 KiB
Objective-C

#import "MLNIntegrationTestCase.h"
@implementation MLNIntegrationTestCase
+ (XCTestSuite*)defaultTestSuite {
XCTestSuite *defaultTestSuite = [super defaultTestSuite];
NSArray *tests = defaultTestSuite.tests;
XCTestSuite *newTestSuite = [XCTestSuite testSuiteWithName:defaultTestSuite.name];
BOOL runPendingTests = [[[NSProcessInfo processInfo] environment][@"MAPBOX_RUN_PENDING_TESTS"] boolValue];
NSString *apiKey = [[NSProcessInfo processInfo] environment][@"MLN_API_KEY"];
for (XCTest *test in tests) {
// Check for pending tests
if ([test.name containsString:@"PENDING"]) {
if (!runPendingTests) {
printf("warning: '%s' is a pending test - skipping\n", test.name.UTF8String);
continue;
}
}
// Check for tests that require a valid access token
if ([test.name containsString:@"LOCKED"]) {
if (!apiKey) {
printf("warning: MLN_API_KEY env var is required for test '%s' - skipping.\n", test.name.UTF8String);
continue;
}
}
[newTestSuite addTest:test];
}
return newTestSuite;
}
- (void)setUp {
[super setUp];
NSString *apiKey;
if ([self.name containsString:@"LOCKED"]) {
apiKey = [[NSProcessInfo processInfo] environment][@"MLN_API_KEY"];
if (!apiKey) {
printf("warning: MLN_API_KEY env var is required for test '%s' - trying anyway.\n", self.name.UTF8String);
}
}
[MLNSettings setApiKey:apiKey ?: @"pk.feedcafedeadbeefbadebede"];
}
@end