File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,21 @@ describe("NaverParser", () => {
17
17
expect ( result ) . toEqual ( expectedPaymentHistoryItems ) ;
18
18
} ) ;
19
19
} ) ;
20
+
21
+ describe ( "parseInformationForNextPaymentHistory" , ( ) => {
22
+ it ( "should parse" , ( ) => {
23
+ // given
24
+ const parser = new NaverParser ( ) ;
25
+
26
+ // when
27
+ const result = parser . parseInformationForNextPaymentHistory (
28
+ searchPaymentHistoryJson
29
+ ) ;
30
+
31
+ // then
32
+ expect ( result . hasNext ) . toBe ( true ) ;
33
+ expect ( result . lastHistoryId ) . toBe ( "order-2021110243152861" ) ;
34
+ expect ( result . lastHistoryDateTimestamp ) . toBe ( 1635853254000 ) ;
35
+ } ) ;
36
+ } ) ;
20
37
} ) ;
Original file line number Diff line number Diff line change @@ -24,4 +24,17 @@ export class NaverParser {
24
24
} ) ;
25
25
return paymentHistories ;
26
26
}
27
+
28
+ parseInformationForNextPaymentHistory ( jsonString : string ) : {
29
+ hasNext : boolean ;
30
+ lastHistoryId : string ;
31
+ lastHistoryDateTimestamp : number ;
32
+ } {
33
+ const data = JSON . parse ( jsonString ) as PaymentHistoryResponse ;
34
+
35
+ const hasNext = data . result . hasNext ;
36
+ const lastHistoryId = data . result . lastId ;
37
+ const lastHistoryDateTimestamp = data . result . lastDate ;
38
+ return { hasNext, lastHistoryId, lastHistoryDateTimestamp } ;
39
+ }
27
40
}
You can’t perform that action at this time.
0 commit comments