FPRConsoleURLGeneratorTest.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <XCTest/XCTest.h>
  15. #import "FirebasePerformance/Sources/Common/FPRConsoleURLGenerator.h"
  16. @interface FPRConsoleURLGeneratorTest : XCTestCase
  17. @end
  18. @implementation FPRConsoleURLGeneratorTest
  19. static NSString *const PROJECT_ID = @"test-project";
  20. static NSString *const BUNDLE_ID = @"test-bundle";
  21. static NSString *const TRACE_NAME = @"test-trace";
  22. /** Tests that the dashboard URL is correctly generated. */
  23. - (void)testDashboardURL {
  24. NSString *url = [FPRConsoleURLGenerator generateDashboardURLWithProjectID:PROJECT_ID
  25. bundleID:BUNDLE_ID];
  26. NSString *expectedURL = @"https://console.firebase.google.com/project/test-project/performance/"
  27. @"app/ios:test-bundle/trends?utm_source=perf-ios-sdk&utm_medium=ios-ide";
  28. XCTAssertEqualObjects(url, expectedURL);
  29. }
  30. /** Tests that the custom trace URL is correctly generated. */
  31. - (void)testCustomTraceURL {
  32. NSString *url = [FPRConsoleURLGenerator generateCustomTraceURLWithProjectID:PROJECT_ID
  33. bundleID:BUNDLE_ID
  34. traceName:TRACE_NAME];
  35. NSString *expectedURL =
  36. @"https://console.firebase.google.com/project/test-project/performance/app/ios:test-bundle/"
  37. @"troubleshooting/trace/DURATION_TRACE/test-trace?utm_source=perf-ios-sdk&utm_medium=ios-ide";
  38. XCTAssertEqualObjects(url, expectedURL);
  39. }
  40. /** Tests that the screen trace URL is correctly generated. */
  41. - (void)testScreenTraceURL {
  42. NSString *url = [FPRConsoleURLGenerator generateScreenTraceURLWithProjectID:PROJECT_ID
  43. bundleID:BUNDLE_ID
  44. traceName:TRACE_NAME];
  45. NSString *expectedURL =
  46. @"https://console.firebase.google.com/project/test-project/performance/app/ios:test-bundle/"
  47. @"troubleshooting/trace/SCREEN_TRACE/test-trace?utm_source=perf-ios-sdk&utm_medium=ios-ide";
  48. XCTAssertEqualObjects(url, expectedURL);
  49. }
  50. @end