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+ import { CreateWebRtcConnectionRequest } from '../../../models/create-web-rtc-connection-request' ;
2+ import { EndpointDirectionEnum } from '../../../models/endpoint-direction-enum' ;
3+ import { EndpointTypeEnum } from '../../../models/endpoint-type-enum' ;
4+
5+ describe ( 'CreateWebRtcConnectionRequest' , ( ) => {
6+ test ( 'should support full request shape' , ( ) => {
7+ const request : CreateWebRtcConnectionRequest = {
8+ type : EndpointTypeEnum . Webrtc ,
9+ direction : EndpointDirectionEnum . Bidirectional ,
10+ eventCallbackUrl : 'https://example.com/callback' ,
11+ eventFallbackUrl : 'https://example.com/fallback' ,
12+ tag : 'webrtc-test'
13+ } ;
14+
15+ expect ( request . type ) . toBe ( EndpointTypeEnum . Webrtc ) ;
16+ expect ( request . direction ) . toBe ( EndpointDirectionEnum . Bidirectional ) ;
17+ expect ( request . eventCallbackUrl ) . toBe ( 'https://example.com/callback' ) ;
18+ expect ( request . eventFallbackUrl ) . toBe ( 'https://example.com/fallback' ) ;
19+ expect ( request . tag ) . toBe ( 'webrtc-test' ) ;
20+ } ) ;
21+ } ) ;
Original file line number Diff line number Diff line change 1+ import { ErrorResponse } from '../../../models/error-response' ;
2+ import { Link } from '../../../models/link' ;
3+ import { ModelError } from '../../../models/model-error' ;
4+
5+ describe ( 'ErrorResponse' , ( ) => {
6+ test ( 'should support full error response shape' , ( ) => {
7+ const link : Link = {
8+ rel : 'self' ,
9+ href : 'http://api.example.com/endpoints'
10+ } ;
11+
12+ const error : ModelError = {
13+ code : 404 ,
14+ description : 'Endpoint not found'
15+ } ;
16+
17+ const response : ErrorResponse = {
18+ links : [ link ] ,
19+ data : null ,
20+ errors : [ error ]
21+ } ;
22+
23+ expect ( response . links ) . toHaveLength ( 1 ) ;
24+ expect ( response . links [ 0 ] . rel ) . toBe ( 'self' ) ;
25+ expect ( response . links [ 0 ] . href ) . toBe ( 'http://api.example.com/endpoints' ) ;
26+ expect ( response . data ) . toBeNull ( ) ;
27+ expect ( response . errors ) . toHaveLength ( 1 ) ;
28+ expect ( response . errors [ 0 ] . code ) . toBe ( 404 ) ;
29+ expect ( response . errors [ 0 ] . description ) . toBe ( 'Endpoint not found' ) ;
30+ } ) ;
31+ } ) ;
Original file line number Diff line number Diff line change 1+ import { Page } from '../../../models/page' ;
2+
3+ describe ( 'Page' , ( ) => {
4+ test ( 'should support full page shape' , ( ) => {
5+ const page : Page = {
6+ pageSize : 25 ,
7+ totalElements : 100 ,
8+ totalPages : 4 ,
9+ pageNumber : 1
10+ } ;
11+
12+ expect ( page . pageSize ) . toBe ( 25 ) ;
13+ expect ( page . totalElements ) . toBe ( 100 ) ;
14+ expect ( page . totalPages ) . toBe ( 4 ) ;
15+ expect ( page . pageNumber ) . toBe ( 1 ) ;
16+ } ) ;
17+ } ) ;
Original file line number Diff line number Diff line change 1+ import { SipConnectionMetadata } from '../../../models/sip-connection-metadata' ;
2+ import { SipCredentials } from '../../../models/sip-credentials' ;
3+
4+ describe ( 'SipConnectionMetadata' , ( ) => {
5+ test ( 'should support full SIP connection metadata shape' , ( ) => {
6+ const credentials : SipCredentials = {
7+ username : 'sip-user' ,
8+ password : 'sip-pass'
9+ } ;
10+
11+ const metadata : SipConnectionMetadata = {
12+ ipAddress : '192.168.1.100' ,
13+ port : 5060 ,
14+ credentials,
15+ uuiHeader : 'test-uui-header'
16+ } ;
17+
18+ expect ( metadata . ipAddress ) . toBe ( '192.168.1.100' ) ;
19+ expect ( metadata . port ) . toBe ( 5060 ) ;
20+ expect ( metadata . credentials ) . toBeDefined ( ) ;
21+ expect ( metadata . credentials ! . username ) . toBe ( 'sip-user' ) ;
22+ expect ( metadata . credentials ! . password ) . toBe ( 'sip-pass' ) ;
23+ expect ( metadata . uuiHeader ) . toBe ( 'test-uui-header' ) ;
24+ } ) ;
25+ } ) ;
Original file line number Diff line number Diff line change 1+ import { SipCredentials } from '../../../models/sip-credentials' ;
2+
3+ describe ( 'SipCredentials' , ( ) => {
4+ test ( 'should support full SIP credentials shape' , ( ) => {
5+ const credentials : SipCredentials = {
6+ username : 'sip-user' ,
7+ password : 'sip-pass'
8+ } ;
9+
10+ expect ( credentials . username ) . toBe ( 'sip-user' ) ;
11+ expect ( credentials . password ) . toBe ( 'sip-pass' ) ;
12+ } ) ;
13+ } ) ;
You can’t perform that action at this time.
0 commit comments