 import XCTest
 import FranticApparatus
 
-func dispatch_delay(when: Double, queue: dispatch_queue_t!, block: dispatch_block_t!) {
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(when * Double(NSEC_PER_SEC))), queue, block)
-}
-
 class FranticApparatusTests: XCTestCase {
 
     class ExpectedRejectionError : Error {

            expectation.fulfill()
        }
        
        dispatch_delay(0.25, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
            promise1.reject(ExpectedRejectionError())
        }
        
        self.waitForExpectationsWithTimeout(1.0) { (error: NSError!) -> () in
        }

                XCTAssertEqual(value, "deferred", "If either onFulfilled or onRejected returns a value x, run the Promise Resolution Procedure [[Resolve]](promise2, x).")
                expectation.fulfill()
            })

        promise1.fulfill(1)
        deferred.fulfill("deferred")

//        dispatch_delay(0.25, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
//            promise1.fulfill(1)
//        }
//        
//        dispatch_delay(0.50, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
//            deferred.fulfill("deferred")
//        }
        
        self.waitForExpectationsWithTimeout(1.0) { (error: NSError!) -> () in
        }
