File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // External class.
2+ import { Testing , TestingToBeMatchers } from '@angular-package/testing' ;
3+ // Class.
4+ import { MessageFunctionBuilder } from '../src/message-function-builder.class' ;
5+ /**
6+ * Initialize `Testing`.
7+ */
8+ const testing = new Testing ( true , true ) ;
9+ const toBe = new TestingToBeMatchers ( ) ;
10+ /**
11+ * Tests.
12+ */
13+ testing . describe ( MessageFunctionBuilder . name , ( ) => {
14+ let messageFunctionBuilder = new MessageFunctionBuilder ( ) ;
15+
16+ beforeEach ( ( ) => ( messageFunctionBuilder = new MessageFunctionBuilder ( ) ) ) ;
17+
18+ // Basic testing.
19+ testing
20+ . it ( `defined` , ( ) =>
21+ toBe
22+ . defined ( messageFunctionBuilder )
23+ . defined ( messageFunctionBuilder )
24+ . instance ( messageFunctionBuilder , MessageFunctionBuilder )
25+ )
26+ . toBeClass ( MessageFunctionBuilder ) ;
27+
28+ testing . it ( `build function` , ( ) => {
29+ messageFunctionBuilder
30+ . setName ( 'guardString' )
31+ . setParam ( 'value' , 'string' )
32+ . setReturn ( 'boolean' )
33+ . build ( ) ;
34+
35+ toBe . string ( messageFunctionBuilder . get ) ;
36+ expect ( messageFunctionBuilder . get ) . toEqual ( 'guardString(value: string): boolean' ) ;
37+ } ) ;
38+ } ) ;
You can’t perform that action at this time.
0 commit comments