File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
__tests__/providers/cognito Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,23 @@ describe('fetchDevices', () => {
81
81
} ) ;
82
82
83
83
it ( 'should fetch devices and parse client response correctly' , async ( ) => {
84
- expect ( await fetchDevices ( ) ) . toEqual ( [ apiOutputDevice ] ) ;
84
+ const {
85
+ id,
86
+ name,
87
+ attributes,
88
+ createDate,
89
+ lastAuthenticatedDate,
90
+ lastModifiedDate,
91
+ } = ( await fetchDevices ( ) ) [ 0 ] ;
92
+ expect ( id ) . toEqual ( apiOutputDevice . id ) ;
93
+ expect ( name ) . toEqual ( apiOutputDevice . name ) ;
94
+ expect ( attributes ) . toEqual ( apiOutputDevice . attributes ) ;
95
+ expect ( createDate ) . toEqual ( apiOutputDevice . createDate ) ;
96
+ expect ( lastAuthenticatedDate ) . toEqual (
97
+ apiOutputDevice . lastAuthenticatedDate ,
98
+ ) ;
99
+ expect ( lastModifiedDate ) . toEqual ( apiOutputDevice . lastModifiedDate ) ;
100
+
85
101
expect ( mockListDevices ) . toHaveBeenCalledWith (
86
102
expect . objectContaining ( { region : 'us-west-2' } ) ,
87
103
expect . objectContaining ( {
Original file line number Diff line number Diff line change 7
7
assertTokenProviderConfig ,
8
8
} from '@aws-amplify/core/internals/utils' ;
9
9
10
- import { FetchDevicesOutput } from '../types' ;
10
+ import { AWSAuthDevice , FetchDevicesOutput } from '../types' ;
11
11
import { DeviceType } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types' ;
12
12
import { assertAuthTokens } from '../utils/types' ;
13
13
import { getRegionFromUserPoolId } from '../../../foundation/parsers' ;
@@ -77,7 +77,7 @@ const parseDevicesResponse = async (
77
77
{ } ,
78
78
) ;
79
79
80
- return {
80
+ const result : AWSAuthDevice = {
81
81
id,
82
82
name : deviceName ,
83
83
attributes,
@@ -91,6 +91,8 @@ const parseDevicesResponse = async (
91
91
? new Date ( DeviceLastAuthenticatedDate * 1000 )
92
92
: undefined ,
93
93
} ;
94
+
95
+ return result ;
94
96
} ,
95
97
) ;
96
98
} ;
Original file line number Diff line number Diff line change @@ -332,4 +332,5 @@ export interface AWSAuthUser {
332
332
*/
333
333
export interface AuthDevice {
334
334
id : string ;
335
+ name ?: string ;
335
336
}
You can’t perform that action at this time.
0 commit comments