@@ -106,93 +106,93 @@ describe('Computation', () => {
106106 expect ( runCount ) . to . equal ( 1 ) ;
107107 } ) ;
108108
109- it ( 'can be cancelled before running' , ( ) => {
110- let onCancelRan = false ;
109+ it ( 'can be aborted before running' , ( ) => {
110+ let onAbortRan = false ;
111111 const computation = new Computation (
112112 ( ) => ( { value : 123 } ) ,
113113 ( ) => {
114- onCancelRan = true ;
114+ onAbortRan = true ;
115115 } ,
116116 ) ;
117- computation . cancel ( ) ;
117+ computation . abort ( ) ;
118118 expect ( ( ) => computation . result ( ) ) . to . throw ( 'Cancelled!' ) ;
119- expect ( onCancelRan ) . to . equal ( false ) ;
119+ expect ( onAbortRan ) . to . equal ( false ) ;
120120 } ) ;
121121
122- it ( 'cannot be cancelled after running synchronously' , ( ) => {
123- let onCancelRan = false ;
122+ it ( 'cannot be aborted after running synchronously' , ( ) => {
123+ let onAbortRan = false ;
124124 const computation = new Computation (
125125 ( ) => ( { value : 123 } ) ,
126126 ( ) => {
127- onCancelRan = true ;
127+ onAbortRan = true ;
128128 } ,
129129 ) ;
130130
131131 computation . prime ( ) ;
132- computation . cancel ( ) ;
132+ computation . abort ( ) ;
133133 expect ( computation . result ( ) ) . to . deep . equal ( { value : 123 } ) ;
134- expect ( onCancelRan ) . to . equal ( false ) ;
134+ expect ( onAbortRan ) . to . equal ( false ) ;
135135 } ) ;
136136
137- it ( 'cannot be cancelled after erroring synchronously' , ( ) => {
138- let onCancelRan = false ;
137+ it ( 'cannot be aborted after erroring synchronously' , ( ) => {
138+ let onAbortRan = false ;
139139 const computation = new Computation (
140140 ( ) => {
141141 throw new Error ( 'failure' ) ;
142142 } ,
143143 ( ) => {
144- onCancelRan = true ;
144+ onAbortRan = true ;
145145 } ,
146146 ) ;
147147
148148 computation . prime ( ) ;
149- computation . cancel ( ) ;
149+ computation . abort ( ) ;
150150 expect ( ( ) => computation . result ( ) ) . to . throw ( 'failure' ) ;
151- expect ( onCancelRan ) . to . equal ( false ) ;
151+ expect ( onAbortRan ) . to . equal ( false ) ;
152152 } ) ;
153153
154- it ( 'can be cancelled while running asynchronously' , ( ) => {
155- let onCancelRan = false ;
154+ it ( 'can be aborted while running asynchronously' , ( ) => {
155+ let onAbortRan = false ;
156156 const computation = new Computation (
157157 ( ) =>
158158 new Promise ( ( ) => {
159159 // Never resolves.
160160 } ) ,
161161 ( ) => {
162- onCancelRan = true ;
162+ onAbortRan = true ;
163163 } ,
164164 ) ;
165165
166166 computation . prime ( ) ;
167- computation . cancel ( ) ;
168- expect ( onCancelRan ) . to . equal ( true ) ;
167+ computation . abort ( ) ;
168+ expect ( onAbortRan ) . to . equal ( true ) ;
169169 expect ( ( ) => computation . result ( ) ) . to . throw ( 'Cancelled!' ) ;
170170 } ) ;
171171
172- it ( 'can be cancelled with a provided reason before running' , ( ) => {
172+ it ( 'can be aborted with a provided reason before running' , ( ) => {
173173 const abortReason = new Error ( 'aborted' ) ;
174174 const computation = new Computation ( ( ) => ( { value : 123 } ) ) ;
175175
176- computation . cancel ( abortReason ) ;
176+ computation . abort ( abortReason ) ;
177177 expect ( ( ) => computation . result ( ) ) . to . throw ( 'aborted' ) ;
178178 } ) ;
179179
180- it ( 'forwards cancellation reason to onCancel while running asynchronously' , ( ) => {
180+ it ( 'forwards abort reason to onAbort while running asynchronously' , ( ) => {
181181 const abortReason = new Error ( 'aborted' ) ;
182- let onCancelReason : unknown ;
182+ let onAbortReason : unknown ;
183183 const computation = new Computation (
184184 ( ) =>
185185 new Promise ( ( ) => {
186186 // Never resolves.
187187 } ) ,
188188 ( reason ) => {
189- onCancelReason = reason ;
189+ onAbortReason = reason ;
190190 } ,
191191 ) ;
192192
193193 computation . prime ( ) ;
194- computation . cancel ( abortReason ) ;
195- expect ( onCancelReason ) . to . equal ( abortReason ) ;
194+ computation . abort ( abortReason ) ;
195+ expect ( onAbortReason ) . to . equal ( abortReason ) ;
196196 expect ( ( ) => computation . result ( ) ) . to . throw ( 'aborted' ) ;
197197 } ) ;
198198} ) ;
0 commit comments