FBConfigurationTests.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <XCTest/XCTest.h>
  10. #import "FBConfiguration.h"
  11. @interface FBConfigurationTests : XCTestCase
  12. @end
  13. @implementation FBConfigurationTests
  14. - (void)setUp
  15. {
  16. [super setUp];
  17. unsetenv("USE_PORT");
  18. unsetenv("VERBOSE_LOGGING");
  19. }
  20. - (void)testBindingPortDefault
  21. {
  22. XCTAssertTrue(NSEqualRanges([FBConfiguration bindingPortRange], NSMakeRange(8100, 100)));
  23. }
  24. - (void)testBindingPortEnvironmentOverwrite
  25. {
  26. setenv("USE_PORT", "1000", 1);
  27. XCTAssertTrue(NSEqualRanges([FBConfiguration bindingPortRange], NSMakeRange(1000, 1)));
  28. }
  29. - (void)testVerboseLoggingDefault
  30. {
  31. XCTAssertFalse([FBConfiguration verboseLoggingEnabled]);
  32. }
  33. - (void)testVerboseLoggingEnvironmentOverwrite
  34. {
  35. setenv("VERBOSE_LOGGING", "YES", 1);
  36. XCTAssertTrue([FBConfiguration verboseLoggingEnabled]);
  37. }
  38. @end