Skip to content

Commit

Permalink
[Tests] Introducing tests for the ASTabBarController (facebookarchive…
Browse files Browse the repository at this point in the history
…#628)

* introducing tests for the ASTabBarController

* Update ASTabBarControllerTests.m
  • Loading branch information
remirobert authored and nguyenhuy committed Oct 25, 2017
1 parent 128700f commit 8317c11
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions AsyncDisplayKit.xcodeproj/project.pbxproj
Expand Up @@ -307,6 +307,7 @@
B350625C1B010F070018CF92 /* ASLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 0516FA3B1A15563400B4EBED /* ASLog.h */; settings = {ATTRIBUTES = (Public, ); }; };
B350625D1B0111740018CF92 /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 051943141A1575670030A7D0 /* Photos.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
B350625E1B0111780018CF92 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 051943121A1575630030A7D0 /* AssetsLibrary.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
BB5FC3D11F9C9389007F191E /* ASTabBarControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BB5FC3D01F9C9389007F191E /* ASTabBarControllerTests.m */; };
BB5FC3CE1F9BA689007F191E /* ASNavigationControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BB5FC3CD1F9BA688007F191E /* ASNavigationControllerTests.m */; };
C78F7E2B1BF7809800CDEAFC /* ASTableNode.h in Headers */ = {isa = PBXBuildFile; fileRef = B0F880581BEAEC7500D17647 /* ASTableNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
CC034A091E60BEB400626263 /* ASDisplayNode+Convenience.h in Headers */ = {isa = PBXBuildFile; fileRef = CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -784,6 +785,7 @@
B30BF6501C5964B0004FCD53 /* ASLayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutManager.h; path = TextKit/ASLayoutManager.h; sourceTree = "<group>"; };
B30BF6511C5964B0004FCD53 /* ASLayoutManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASLayoutManager.m; path = TextKit/ASLayoutManager.m; sourceTree = "<group>"; };
B35061DA1B010EDF0018CF92 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BB5FC3D01F9C9389007F191E /* ASTabBarControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASTabBarControllerTests.m; sourceTree = "<group>"; };
BB5FC3CD1F9BA688007F191E /* ASNavigationControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASNavigationControllerTests.m; sourceTree = "<group>"; };
BDC2D162BD55A807C1475DA5 /* Pods-AsyncDisplayKitTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AsyncDisplayKitTests.profile.xcconfig"; path = "Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests.profile.xcconfig"; sourceTree = "<group>"; };
CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+Convenience.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1161,6 +1163,7 @@
CCDD148A1EEDCD9D0020834E /* ASCollectionModernDataSourceTests.m */,
BB5FC3CD1F9BA688007F191E /* ASNavigationControllerTests.m */,
CC034A0F1E60C9BF00626263 /* ASRectTableTests.m */,
BB5FC3D01F9C9389007F191E /* ASTabBarControllerTests.m */,
CC11F9791DB181180024D77B /* ASNetworkImageNodeTests.m */,
CC051F1E1D7A286A006434CB /* ASCALayerTests.m */,
CCE4F9B21F0D60AC00062E4E /* ASIntegerMapTests.m */,
Expand Down Expand Up @@ -2135,6 +2138,7 @@
F711994E1D20C21100568860 /* ASDisplayNodeExtrasTests.m in Sources */,
BB5FC3CE1F9BA689007F191E /* ASNavigationControllerTests.m in Sources */,
ACF6ED5D1B178DC700DA7C62 /* ASDimensionTests.mm in Sources */,
BB5FC3D11F9C9389007F191E /* ASTabBarControllerTests.m in Sources */,
695BE2551DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm in Sources */,
CCA221D31D6FA7EF00AF6A0F /* ASViewControllerTests.m in Sources */,
058D0A38195D057000B7D73C /* ASDisplayLayerTests.m in Sources */,
Expand Down
45 changes: 45 additions & 0 deletions Tests/ASTabBarControllerTests.m
@@ -0,0 +1,45 @@
//
// ASTabBarControllerTests.m
// Texture
//
// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//

#import <XCTest/XCTest.h>
#import "ASTabBarController.h"
#import "ASViewController.h"

@interface ASTabBarControllerTests: XCTestCase

@end

@implementation ASTabBarControllerTests

- (void)testTabBarControllerSelectIndex {
ASViewController *firstViewController = [ASViewController new];
ASViewController *secondViewController = [ASViewController new];
NSArray *viewControllers = @[firstViewController, secondViewController];
ASTabBarController *tabBarController = [ASTabBarController new];
[tabBarController setViewControllers:viewControllers];
[tabBarController setSelectedIndex:1];
XCTAssertTrue([tabBarController.viewControllers isEqualToArray:viewControllers]);
XCTAssertEqual(tabBarController.selectedViewController, secondViewController);
}

- (void)testTabBarControllerSelectViewController {
ASViewController *firstViewController = [ASViewController new];
ASViewController *secondViewController = [ASViewController new];
NSArray *viewControllers = @[firstViewController, secondViewController];
ASTabBarController *tabBarController = [ASTabBarController new];
[tabBarController setViewControllers:viewControllers];
[tabBarController setSelectedViewController:secondViewController];
XCTAssertTrue([tabBarController.viewControllers isEqualToArray:viewControllers]);
XCTAssertEqual(tabBarController.selectedViewController, secondViewController);
}

@end

0 comments on commit 8317c11

Please sign in to comment.