@@ -9,8 +9,8 @@ var ObservationRecorder = require("can-observation-recorder");
99
1010QUnit . module ( 'can-simple-observable/resolver' ) ;
1111
12- QUnit . test ( "timer with teardown" , function ( ) {
13- QUnit . stop ( ) ;
12+ QUnit . test ( "timer with teardown" , function ( assert ) {
13+ var done = assert . async ( ) ;
1414
1515 var CALLS = [ ] ;
1616
@@ -29,64 +29,66 @@ QUnit.test("timer with teardown", function(){
2929 } ;
3030 } , { } ) ;
3131
32- QUnit . equal ( obs . get ( ) , 0 , "got initial value unbound" ) ;
33- QUnit . deepEqual ( CALLS , [ "GENERATOR" , "TEARDOWN" ] , "initial unbound read" ) ;
32+ assert . equal ( obs . get ( ) , 0 , "got initial value unbound" ) ;
33+ assert . deepEqual ( CALLS , [ "GENERATOR" , "TEARDOWN" ] , "initial unbound read" ) ;
3434 CALLS = [ ] ;
3535
3636 var handler = function ( newVal ) {
37- QUnit . equal ( newVal , 1 , "got first emitted value" ) ;
38- QUnit . equal ( obs . get ( ) , 1 , "got first emitted value" ) ;
39- QUnit . deepEqual ( CALLS , [ "INTERVAL" ] , "emitted value" ) ;
37+ assert . equal ( newVal , 1 , "got first emitted value" ) ;
38+ assert . equal ( obs . get ( ) , 1 , "got first emitted value" ) ;
39+ assert . deepEqual ( CALLS , [ "INTERVAL" ] , "emitted value" ) ;
4040 CALLS = [ ] ;
4141 obs . off ( handler ) ;
42- QUnit . deepEqual ( CALLS , [ "TEARDOWN" ] , "emitted value" ) ;
43- QUnit . start ( ) ;
42+ assert . deepEqual ( CALLS , [ "TEARDOWN" ] , "emitted value" ) ;
43+ done ( ) ;
4444 } ;
4545
4646 obs . on ( handler ) ;
47- QUnit . equal ( obs . get ( ) , 0 , "got initial value after bind" ) ;
48- QUnit . deepEqual ( CALLS , [ "GENERATOR" ] , "initial bind" ) ;
47+ assert . equal ( obs . get ( ) , 0 , "got initial value after bind" ) ;
48+ assert . deepEqual ( CALLS , [ "GENERATOR" ] , "initial bind" ) ;
4949 CALLS = [ ] ;
5050
5151} ) ;
5252var queues = require ( "can-queues" ) ;
53- QUnit . test ( 'basics listenTo' , 14 , function ( assert ) {
53+ QUnit . test ( 'basics listenTo' , function ( assert ) {
54+ assert . expect ( 14 ) ;
5455 var number = new SimpleObservable ( 1 ) ;
5556
5657 var map = mapEventMixin ( {
5758 property : 1
5859 } ) ;
5960
6061 var obs = new ResolverObservable ( function testee ( value ) {
61- QUnit . equal ( value . resolve ( 6 ) , 6 , "resolve returns passed value" ) ;
62+ assert . equal ( value . resolve ( 6 ) , 6 , "resolve returns passed value" ) ;
6263
6364
6465 value . listenTo ( number , function ( newNumber ) {
6566 assert . equal ( newNumber , 2 , "got the new number" ) ;
6667 assert . equal ( this , map , "listenTo this is the context" ) ;
67- QUnit . equal ( value . resolve ( 5 ) , 5 , "resolve returns passed value" ) ;
68+ assert . equal ( value . resolve ( 5 ) , 5 , "resolve returns passed value" ) ;
6869 } ) ;
6970
7071 } , map ) ;
7172
7273 assert . equal ( obs . get ( ) , 6 , "got unbound value" ) ;
7374 assert . equal ( canReflect . getValue ( obs ) , 6 , "got unbound value" ) ;
7475 var listenHandlers = obs . binder [ canSymbol . for ( "can.meta" ) ] . listenHandlers ;
75- QUnit . equal ( listenHandlers . size ( ) , 0 , "0 handlers after read" ) ;
76+ assert . equal ( listenHandlers . size ( ) , 0 , "0 handlers after read" ) ;
7677
7778 obs . on ( function ( newVal ) {
78- QUnit . equal ( newVal , 5 , "got the new value" ) ;
79+ assert . equal ( newVal , 5 , "got the new value" ) ;
7980 } ) ;
8081 assert . equal ( obs . get ( ) , 6 , "got unbound value" ) ;
8182 listenHandlers = obs . binder [ canSymbol . for ( "can.meta" ) ] . listenHandlers ;
82- QUnit . equal ( listenHandlers . size ( ) , 1 , "1 handlers after bind" ) ;
83+ assert . equal ( listenHandlers . size ( ) , 1 , "1 handlers after bind" ) ;
8384 number . set ( 2 ) ;
8485
8586 assert . equal ( obs . get ( ) , 5 , "got updated value" ) ;
8687 assert . equal ( canReflect . getValue ( obs ) , 5 , "got updated value" ) ;
8788} ) ;
8889
89- QUnit . test ( "setter" , 6 , function ( ) {
90+ QUnit . test ( "setter" , function ( assert ) {
91+ assert . expect ( 6 ) ;
9092 var state = new SimpleObservable ( "IL" ) ;
9193
9294 var city = new ResolverObservable ( function fullName ( value ) {
@@ -100,27 +102,27 @@ QUnit.test("setter", 6, function(){
100102 } , mapEventMixin ( { } ) ) ;
101103
102104 city . set ( "Chicago" ) ;
103- QUnit . equal ( city . get ( ) , "Chicago" , "got unbound value" ) ;
105+ assert . equal ( city . get ( ) , "Chicago" , "got unbound value" ) ;
104106
105107 city . set ( "Rockford" ) ;
106- QUnit . equal ( city . get ( ) , "Rockford" , "got unbound value after another set" ) ;
108+ assert . equal ( city . get ( ) , "Rockford" , "got unbound value after another set" ) ;
107109
108110 var CITIES = [ ] ;
109111 city . on ( function ( city ) {
110112 CITIES . push ( city ) ;
111113 } ) ;
112114
113- QUnit . equal ( city . get ( ) , "Rockford" , "got bound value after binding" ) ;
115+ assert . equal ( city . get ( ) , "Rockford" , "got bound value after binding" ) ;
114116
115117 state . set ( "CA" ) ;
116118
117- QUnit . equal ( city . get ( ) , null , "updated city after state set" ) ;
119+ assert . equal ( city . get ( ) , null , "updated city after state set" ) ;
118120
119121 city . set ( "San Jose" ) ;
120122
121- QUnit . equal ( city . get ( ) , "San Jose" , "updated city after state set" ) ;
123+ assert . equal ( city . get ( ) , "San Jose" , "updated city after state set" ) ;
122124
123- QUnit . deepEqual ( CITIES , [ null , "San Jose" ] , "events right" ) ;
125+ assert . deepEqual ( CITIES , [ null , "San Jose" ] , "events right" ) ;
124126} ) ;
125127
126128QUnit . test ( "getValueDependencies and value dependencies" , function ( assert ) {
@@ -222,7 +224,7 @@ QUnit.test("getWhatIChange", function(assert) {
222224 assert . ok ( canReflect . getWhatIChange ( dep ) . derive . valueDependencies . has ( obs ) ) ;
223225} ) ;
224226
225- QUnit . test ( "proactive binding doesn't last past binding (can-stache#486)" , function ( ) {
227+ QUnit . test ( "proactive binding doesn't last past binding (can-stache#486)" , function ( assert ) {
226228 var v = new SimpleObservable ( 2 ) ;
227229
228230 var readCount = 0 ;
@@ -246,11 +248,11 @@ QUnit.test("proactive binding doesn't last past binding (can-stache#486)", funct
246248
247249 v . set ( 3 ) ;
248250
249- QUnit . equal ( readCount , 0 , "internal observation only updated once" ) ;
251+ assert . equal ( readCount , 0 , "internal observation only updated once" ) ;
250252
251253} ) ;
252254
253- QUnit . test ( "reading observables does not leak the observable read" , function ( ) {
255+ QUnit . test ( "reading observables does not leak the observable read" , function ( assert ) {
254256 // if an observation is listening is reading this value, the value
255257 // should not ObservationRecorder.add its deps
256258 // there is a similar test in can-define
@@ -267,13 +269,13 @@ QUnit.test("reading observables does not leak the observable read", function(){
267269
268270 var records = ObservationRecorder . stop ( ) ;
269271
270- QUnit . equal ( records . keyDependencies . size , 0 , "there are no key dependencies" ) ;
271- QUnit . equal ( records . valueDependencies . size , 0 , "there are no valueDependencies" ) ;
272+ assert . equal ( records . keyDependencies . size , 0 , "there are no key dependencies" ) ;
273+ assert . equal ( records . valueDependencies . size , 0 , "there are no valueDependencies" ) ;
272274} ) ;
273275
274- QUnit . test ( "initial value on lastSet can be set (can-define#397)" , function ( ) {
276+ QUnit . test ( "initial value on lastSet can be set (can-define#397)" , function ( assert ) {
275277 var defaulted = new ResolverObservable ( function ( props ) {
276- QUnit . equal ( props . lastSet . get ( ) , 5 , "observable has default value" ) ;
278+ assert . equal ( props . lastSet . get ( ) , 5 , "observable has default value" ) ;
277279 } , { } , 5 ) ;
278280 defaulted . get ( ) ;
279281} ) ;
0 commit comments