-
Notifications
You must be signed in to change notification settings - Fork 953
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ios): resolve sandbox dir issue in debug mode
- Loading branch information
Showing
7 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,5 +86,30 @@ - (void)testHippyURLWithString { | |
|
||
} | ||
|
||
- (void)testGetBaseDirFromResourcePath { | ||
// Test with an HTTP URL | ||
NSURL *httpURL = [NSURL URLWithString:@"http://localhost:38989/index.bundle?platform=ios"]; | ||
NSString *expectedBaseHTTPURL = @"http://localhost:38989/"; | ||
NSString *baseHTTPURLString = [HippyUtils getBaseDirFromResourcePath:httpURL]; | ||
XCTAssertEqualObjects(baseHTTPURLString, expectedBaseHTTPURL, @"The base URL should be truncated after the last slash."); | ||
|
||
// Test with a file URL | ||
NSURL *fileURL = [NSURL fileURLWithPath:@"/Users/username/Documents/test.txt"]; | ||
NSString *expectedBaseFileURL = @"file:///Users/username/Documents/"; | ||
NSString *baseFileURLString = [HippyUtils getBaseDirFromResourcePath:fileURL]; | ||
XCTAssertEqualObjects(baseFileURLString, expectedBaseFileURL, @"The base file URL should be the directory path."); | ||
|
||
// Test with a URL with no slashes | ||
NSURL *noSlashesURL = [NSURL URLWithString:@"mailto:[email protected]"]; | ||
NSString *expectedNoSlashesURL = @"mailto:[email protected]"; | ||
NSString *baseNoSlashesURLString = [HippyUtils getBaseDirFromResourcePath:noSlashesURL]; | ||
XCTAssertEqualObjects(baseNoSlashesURLString, expectedNoSlashesURL, @"The URL with no slashes should be returned as is."); | ||
|
||
// Test with a nil URL | ||
NSURL *nilURL = nil; | ||
NSString *baseNilURLString = [HippyUtils getBaseDirFromResourcePath:nilURL]; | ||
XCTAssertNil(baseNilURLString, @"The base URL should be nil for a nil input URL."); | ||
} | ||
|
||
|
||
@end |