File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,10 @@ import { MockedPlayback } from "./MockedPlayback";
15
15
16
16
describe ( "PlaybackQueue" , ( ) => {
17
17
let playbackQueue : PlaybackQueue ;
18
+ let mockRoom : Mocked < Room > ;
18
19
19
20
beforeEach ( ( ) => {
20
- const mockRoom = {
21
+ mockRoom = {
21
22
getMember : jest . fn ( ) ,
22
23
} as unknown as Mocked < Room > ;
23
24
playbackQueue = new PlaybackQueue ( mockRoom ) ;
@@ -63,4 +64,24 @@ describe("PlaybackQueue", () => {
63
64
64
65
expect ( mockPlayback . skipTo ) . toHaveBeenCalledWith ( 1 ) ;
65
66
} ) ;
67
+
68
+ it ( "should ignore the nullish clock state when loading" , ( ) => {
69
+ const clockStates = new Map ( [
70
+ [ "a" , 1 ] ,
71
+ [ "b" , null ] ,
72
+ [ "c" , 3 ] ,
73
+ ] ) ;
74
+ localStorage . setItem (
75
+ `mx_voice_message_clocks_${ mockRoom . roomId } ` ,
76
+ JSON . stringify ( Array . from ( clockStates . entries ( ) ) ) ,
77
+ ) ;
78
+ playbackQueue = new PlaybackQueue ( mockRoom ) ;
79
+
80
+ // @ts -ignore
81
+ expect ( playbackQueue . clockStates . has ( "a" ) ) . toBe ( true ) ;
82
+ // @ts -ignore
83
+ expect ( playbackQueue . clockStates . has ( "b" ) ) . toBe ( false ) ;
84
+ // @ts -ignore
85
+ expect ( playbackQueue . clockStates . has ( "c" ) ) . toBe ( true ) ;
86
+ } ) ;
66
87
} ) ;
You can’t perform that action at this time.
0 commit comments