1- // Object.
21import { is } from '@angular-package/type' ;
32// Class.
43import { Testing } from '../lib/testing.class' ;
54/**
65 * Initialize testing.
76 */
8- const testing = new Testing (
7+ const t = new Testing (
98 true , // Disallows executing the `describe()` method globally.
109 true , // Disallows executing the `it()` method globally.
1110 {
1211 // describe: [1, 2, 3, 5], // Executable unique numbers of `describe()` methods to execute when global executing is disallowed.
1312 // it: [1], // Executable unique numbers of `it()` methods inside the `describe()` to execute when global executing is disallowed.
14- }
15- ) ;
16-
17- testing . describe ( '[counter] First describe' , ( ) => {
18- testing
19- . it ( '[counter] First it() in first describe 1-1' , ( ) =>
20- expect ( false ) . toBeFalse ( )
21- )
22- . it ( '[counter] Second it() in first describe 1-2' , ( ) =>
23- expect ( true ) . toBeTrue ( )
24- )
25- . it ( '[counter] Second it() in first describe 1-3' , ( ) =>
26- expect ( true ) . toBeTrue ( )
27- )
28- . it ( '[counter] Fourth it() in first describe() 1-4' , ( ) =>
29- expect ( true ) . toBeTrue ( )
30- )
31- . describe ( '[counter] Second describe()' , ( ) => {
32- testing . it ( '[counter] First it() in second describe() 2-1' , ( ) =>
33- expect ( true ) . toBeTrue ( )
34- ) ;
35- } )
36- . describe ( '[counter] Third describe()' , ( ) => {
37- testing . it ( '[counter] First it() in third describe() 3-1' , ( ) =>
38- expect ( true ) . toBeTrue ( )
39- ) ;
40- } )
41- . describe ( '[counter] Fourth describe()' , ( ) => {
42- testing . it ( '[counter] First it() in fourth describe() 3-1' , ( ) =>
43- expect ( true ) . toBeTrue ( )
44- ) ;
45- } ) ;
46- } ) ;
47- testing . describe ( '[counter] Fifth describe' , ( ) =>
48- testing . it ( '[counter] First it() in fifth describe 5-1' , ( ) =>
49- expect ( false ) . toBeFalse ( )
50- )
13+ } ,
14+ true
5115) ;
5216
5317/**
@@ -56,38 +20,33 @@ testing.describe('[counter] Fifth describe', () =>
5620const testingDescribe = Testing . defineDescribe ( 'defineDescribe()' , ( ) => {
5721 const numberSpec = Testing . defineIt (
5822 'The value must be a number type' ,
59- ( ) => {
60- expect ( is . number ( 5 ) ) . toBeTruthy ( ) ;
61- } ,
23+ ( ) => expect ( is . number ( 5 ) ) . toBeTruthy ( ) ,
6224 3000
6325 ) ;
6426 numberSpec ( false ) ; // Do not execute.
6527 numberSpec ( false ) ; // Execute.
6628} ) ;
6729
6830testingDescribe ( false ) ; // Do not execute.
69- testingDescribe ( false ) ; // Execute.
7031
7132/**
7233 * describe().
7334 */
74- testing . describe (
75- '[counter] describe()' ,
76- ( ) => { } ,
77- false // Whether or not execute suite
78- ) ;
35+ // testing.describe(
36+ // '[counter] describe()',
37+ // () => {},
38+ // false // Whether or not execute suite
39+ // );
7940
8041/**
8142 * it().
8243 */
83- testing . describe (
44+ t . describe (
8445 '[counter] describe()' ,
8546 ( ) =>
86- testing . it (
47+ t . it (
8748 '[counter] it()' ,
88- ( ) => {
89- expect ( true ) . toBeTruthy ( ) ;
90- } ,
49+ ( ) => expect ( true ) . toBeTruthy ( ) ,
9150 false // Whether or not execute spec
9251 ) ,
9352 false // Whether or not execute suite
@@ -96,78 +55,78 @@ testing.describe(
9655/**
9756 * toBe()
9857 */
99- testing . describe ( 'string' , ( ) => {
100- testing . toBe (
101- `Checks the value against the string` ,
58+ t . describe ( 'string' , ( ) => {
59+ t . toBe . be (
10260 is . stringType ( 'my name' ) ,
103- true
61+ true ,
62+ `Checks the value against the string` ,
10463 ) ;
10564} ) ;
10665
10766/**
10867 * toBeBigInt()
10968 */
110- testing . describe ( 'bigint' , ( ) => testing . toBeBigInt ( 1n ) ) ;
69+ t . describe ( 'bigint' , ( ) => t . toBeBigInt ( 1n ) ) ;
11170
11271/**
11372 * toBeBooleanType()
11473 */
115- testing . describe ( 'boolean' , ( ) => testing . toBeBooleanType ( false ) ) ;
74+ t . describe ( 'boolean' , ( ) => t . toBeBooleanType ( false ) ) ;
11675
11776/**
11877 * toBeClass()
11978 */
120- testing . describe ( 'class Person' , ( ) => {
79+ t . describe ( 'class Person' , ( ) => {
12180 class Person { }
122- testing . toBeClass ( Person ) ;
81+ t . toBeClass ( Person ) ;
12382} ) ;
12483
12584/**
12685 * toBeInstanceOfArray()
12786 */
128- testing . describe ( 'Array' , ( ) => testing . toBeInstanceOfArray ( [ '1' ] ) ) ;
87+ t . describe ( 'Array' , ( ) => t . toBeInstanceOfArray ( [ '1' ] ) ) ;
12988
13089/**
13190 * toBeInstanceOfBoolean()
13291 */
133- testing . describe ( 'Boolean' , ( ) => testing . toBeInstanceOfBoolean ( new Boolean ( ) ) ) ;
92+ t . describe ( 'Boolean' , ( ) => t . toBeInstanceOfBoolean ( false ) ) ;
13493
13594/**
13695 * toBeInstanceOfDate()
13796 */
138- testing . describe ( 'Date' , ( ) => testing . toBeInstanceOfDate ( new Date ( ) ) ) ;
97+ t . describe ( 'Date' , ( ) => t . toBeInstanceOfDate ( new Date ( ) ) ) ;
13998
14099/**
141100 * toBeInstanceOfError()
142101 */
143- testing . describe ( 'Error' , ( ) => {
102+ t . describe ( 'Error' , ( ) => {
144103 try {
145104 throw new Error ( ) ;
146105 } catch ( e ) {
147- testing . toBeInstanceOfError ( e ) ;
106+ t . toBeInstanceOfError ( e ) ;
148107 }
149108} ) ;
150109
151110/**
152111 * toBeInstanceOfFunction()
153112 */
154- testing . describe ( `Function` , ( ) => testing . toBeInstanceOfFunction ( ( ) => { } ) ) ;
113+ t . describe ( `Function` , ( ) => t . toBeInstanceOfFunction ( ( ) => { } ) ) ;
155114
156115/**
157116 * toBeInstanceOfMap()
158117 */
159- testing . describe ( `Map` , ( ) => testing . toBeInstanceOfMap ( new Map ( ) ) ) ;
118+ t . describe ( `Map` , ( ) => t . toBeInstanceOfMap ( new Map ( ) ) ) ;
160119
161120/**
162121 * toBeInstanceOfNumber()
163122 */
164- testing . describe ( `Number` , ( ) => testing . toBeInstanceOfNumber ( new Number ( 27 ) ) ) ;
123+ t . describe ( `Number` , ( ) => t . toBeInstanceOfNumber ( new Number ( 27 ) ) ) ;
165124
166125/**
167126 * toBeInstanceOfObject()
168127 */
169- testing . describe ( `Object` , ( ) =>
170- testing . toBeInstanceOfObject ( new Object ( { } ) ) . toBeInstanceOfObject ( { } )
128+ t . describe ( `Object` , ( ) =>
129+ t . toBeInstanceOfObject ( new Object ( { } ) ) . toBeInstanceOfObject ( { } )
171130) ;
172131
173132/**
@@ -179,109 +138,109 @@ const myPromise = new Promise((resolve, reject) => {
179138 // reject('foo');
180139 } , 300 ) ;
181140} ) ;
182- testing . describe ( `Promise` , ( ) => testing . toBeInstanceOfPromise ( myPromise ) ) ;
141+ t . describe ( `Promise` , ( ) => t . toBeInstanceOfPromise ( myPromise ) ) ;
183142
184143/**
185144 * toBeInstanceOfRangeError()
186145 */
187- testing . describe ( 'RangeError' , ( ) => {
146+ t . describe ( 'RangeError' , ( ) => {
188147 try {
189148 throw new RangeError ( ) ;
190149 } catch ( e ) {
191- testing . toBeInstanceOfRangeError ( e ) ;
150+ t . toBeInstanceOfRangeError ( e ) ;
192151 }
193152} ) ;
194153
195154/**
196155 * toBeInstanceOfReferenceError()
197156 */
198- testing . describe ( 'ReferenceError' , ( ) => {
157+ t . describe ( 'ReferenceError' , ( ) => {
199158 try {
200159 throw new ReferenceError ( ) ;
201160 } catch ( e ) {
202- testing . toBeInstanceOfReferenceError ( e ) ;
161+ t . toBeInstanceOfReferenceError ( e ) ;
203162 }
204163} ) ;
205164
206165/**
207166 * toBeInstanceOfRegExp()
208167 */
209- testing . describe ( `RegExp` , ( ) =>
210- testing . toBeInstanceOfRegExp ( new RegExp ( / [ ] / g) )
168+ t . describe ( `RegExp` , ( ) =>
169+ t . toBeInstanceOfRegExp ( new RegExp ( / [ ] / g) )
211170) ;
212171
213172/**
214173 * toBeInstanceOfSet()
215174 */
216- testing . describe ( `Set` , ( ) => testing . toBeInstanceOfSet ( new Set ( ) ) ) ;
175+ t . describe ( `Set` , ( ) => t . toBeInstanceOfSet ( new Set ( ) ) ) ;
217176
218177/**
219178 * toBeInstanceOfStorage()
220179 */
221- testing . describe ( `Storage` , ( ) =>
222- testing . toBeInstanceOfStorage ( window . sessionStorage )
180+ t . describe ( `Storage` , ( ) =>
181+ t . toBeInstanceOfStorage ( window . sessionStorage )
223182) ;
224183
225184/**
226185 * toBeInstanceOfString()
227186 */
228- testing . describe ( `String` , ( ) => testing . toBeInstanceOfString ( new String ( ) ) ) ;
187+ t . describe ( `String` , ( ) => t . toBeInstanceOfString ( new String ( ) ) ) ;
229188
230189/**
231190 * toBeInstanceOfSyntaxError()
232191 */
233- testing . describe ( 'SyntaxError' , ( ) => {
192+ t . describe ( 'SyntaxError' , ( ) => {
234193 try {
235194 throw new SyntaxError ( ) ;
236195 } catch ( e ) {
237- testing . toBeInstanceOfSyntaxError ( e ) ;
196+ t . toBeInstanceOfSyntaxError ( e ) ;
238197 }
239198} ) ;
240199
241200/**
242201 * toBeInstanceOfTypeError()
243202 */
244- testing . describe ( 'TypeError' , ( ) => {
203+ t . describe ( 'TypeError' , ( ) => {
245204 try {
246205 throw new TypeError ( ) ;
247206 } catch ( e ) {
248- testing . toBeInstanceOfTypeError ( e ) ;
207+ t . toBeInstanceOfTypeError ( e ) ;
249208 }
250209} ) ;
251210
252211/**
253212 * toBeInstanceOfURIError()
254213 */
255- testing . describe ( 'URIError' , ( ) => {
214+ t . describe ( 'URIError' , ( ) => {
256215 try {
257216 throw new URIError ( ) ;
258217 } catch ( e ) {
259- testing . toBeInstanceOfURIError ( e ) ;
218+ t . toBeInstanceOfURIError ( e ) ;
260219 }
261220} ) ;
262221
263222/**
264223 * toBeInstanceOfWeakSet()
265224 */
266- testing . describe ( `WeakSet` , ( ) => testing . toBeInstanceOfWeakSet ( new WeakSet ( ) ) ) ;
225+ t . describe ( `WeakSet` , ( ) => t . toBeInstanceOfWeakSet ( new WeakSet ( ) ) ) ;
267226
268227/**
269228 * toBeNull()
270229 */
271- testing . describe ( `null` , ( ) => testing . toBeNull ( null ) ) ;
230+ t . describe ( `null` , ( ) => t . toBeNull ( null ) ) ;
272231
273232/**
274233 * toBeNumberType()
275234 */
276- testing . describe ( `number` , ( ) => testing . toBeNumberType ( 5 ) ) ;
235+ t . describe ( `number` , ( ) => t . toBeNumberType ( 5 ) ) ;
277236
278237/**
279238 * toBeStringType()
280239 */
281- testing . describe ( `string` , ( ) => testing . toBeStringType ( 'my name' ) ) ;
240+ t . describe ( `string` , ( ) => t . toBeStringType ( 'my name' ) ) ;
282241
283242/**
284243 * toEqual()
285244 */
286245const firstName = 'My name' ;
287- testing . describe ( `toEqual` , ( ) => testing . toEqual ( ' Expects `firstName` to equal to `My name`' , firstName , 'My name ') , true ) ;
246+ t . describe ( `toEqual` , ( ) => t . toEqual ( firstName , 'My name' , ' Expects `firstName` to equal to `My name`') , true ) ;
0 commit comments