mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-13 09:50:17 +00:00
41 lines
1.0 KiB
Objective-C
41 lines
1.0 KiB
Objective-C
//
|
|
// ASPendingStateControllerTests.m
|
|
// AsyncDisplayKit
|
|
//
|
|
// Created by Adlai Holler on 1/7/16.
|
|
// Copyright © 2016 Facebook. All rights reserved.
|
|
//
|
|
|
|
#import <XCTest/XCTest.h>
|
|
#import "ASPendingStateController.h"
|
|
#import "ASDisplayNode.h"
|
|
|
|
@interface ASPendingStateController (Testing)
|
|
- (BOOL)test_isFlushScheduled;
|
|
@end
|
|
|
|
@interface ASPendingStateControllerTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation ASPendingStateControllerTests
|
|
|
|
- (void)testTheresASharedInstance
|
|
{
|
|
XCTAssertNotNil([ASPendingStateController sharedInstance]);
|
|
}
|
|
|
|
- (void)testThatRegisteringANodeCausesAtFlushAtRunLoopEnd
|
|
{
|
|
ASPendingStateController *ctrl = [ASPendingStateController sharedInstance];
|
|
ASDisplayNode *node = [ASDisplayNode new];
|
|
XCTAssertFalse(ctrl.test_isFlushScheduled);
|
|
[ctrl registerNode:node];
|
|
XCTAssertTrue(ctrl.test_isFlushScheduled);
|
|
NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:1];
|
|
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeout];
|
|
XCTAssertFalse(ctrl.test_isFlushScheduled);
|
|
}
|
|
|
|
@end
|