Przeglądaj źródła

freeze Date in Recurly tests before all calls

beforeEach freezes and resets for each subtest, which does not give
the desired result as the time increases between each subtest, we want
to freeze once at the beginning and reset at the end using before/after.
Brian Gough 11 lat temu
rodzic
commit
cc9c8fdc94

+ 5 - 5
services/web/test/UnitTests/coffee/Subscription/RecurlyWrapperTests.coffee

@@ -108,13 +108,10 @@ describe "RecurlyWrapper", ->
 		Settings.defaultPlanCode =
 			collaborators: 0
 			versioning: false
-		tk.freeze(Date.now())
-	
-	afterEach -> 
-		tk.reset()
-	
+
 	describe "sign", ->
 		before (done) ->
+			tk.freeze Date.now() # freeze the time for these tests
 			RecurlyWrapper.sign({
 				subscription :
 					plan_code : "gold"
@@ -124,6 +121,9 @@ describe "RecurlyWrapper", ->
 				done()
 			)
 
+		after ->
+			tk.reset()
+
 		it "should be signed correctly", ->
 			signed = @signature.split("|")[0]
 			query = @signature.split("|")[1]