From 06b5eaf8dda2228442f45466eddc0ba6222f164d Mon Sep 17 00:00:00 2001 From: Qingzhuo Zhen Date: Wed, 7 Feb 2024 11:44:52 -0800 Subject: [PATCH] AMP-36170 add more unit test --- Tests/AMPUtilsTests.m | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Tests/AMPUtilsTests.m b/Tests/AMPUtilsTests.m index d915c65f..e3296f25 100644 --- a/Tests/AMPUtilsTests.m +++ b/Tests/AMPUtilsTests.m @@ -13,10 +13,19 @@ @interface AMPUtilTests : XCTestCase @end -@implementation AMPUtilTests { - +@interface FakeAMPUtils: AMPUtils +@end + +@implementation FakeAMPUtils + ++ (NSDictionary *)getEnvironment { + return @{@"APP_SANDBOX_CONTAINER_ID": @"test-container-id"}; } +@end + +@implementation AMPUtilTests {} + - (void) testIsSandboxEnabled { BOOL isSandboxEnabled = [AMPUtils isSandboxEnabled]; #if TARGET_OS_OSX @@ -26,4 +35,11 @@ - (void) testIsSandboxEnabled { #endif } +#if TARGET_OS_OSX +- (void) testIsSandboxEnabledWhenMacOSIsSandboxed { + BOOL isSandboxEnabled = [FakeAMPUtils isSandboxEnabled]; + XCTAssertEqual(isSandboxEnabled, YES); +} +#endif + @end