@@ -238,15 +238,14 @@ describe('store:logging', () => {
238238 } )
239239
240240 const clipboard = '{message: "hello"}'
241- window . navigator . clipboard . readText = vi . fn ( ( ) => Promise . resolve ( clipboard ) )
242241
243242 const store = useLogStore ( )
244243 const settings = useSettingsStore ( )
245244
246245 store . hasRemainingEntries = true
247246 expect ( store . hasRemainingEntries ) . toBe ( true )
248247
249- await store . loadClipboard ( )
248+ await store . loadText ( clipboard )
250249
251250 // File parsed, so there are no remaining entries
252251 expect ( store . hasRemainingEntries ) . toBe ( false )
@@ -256,37 +255,6 @@ describe('store:logging', () => {
256255 expect ( store . allEntries ) . toEqual ( [ { message : 'hello' } ] )
257256 } )
258257
259- it ( 'handles unsupported Clipboard API' , async ( ) => {
260- mocks . parseLogString . mockImplementationOnce ( ( ) => [ { message : 'hello' } ] )
261-
262- // clean pinia
263- createTestingPinia ( {
264- fakeApp : true ,
265- createSpy : vi . fn ,
266- stubActions : false ,
267- } )
268-
269- const clipboard = '{message: "hello"}'
270- window . navigator . clipboard . readText = vi . fn ( ( ) => Promise . reject ( new Error ( ) ) )
271- window . prompt = vi . fn ( ( ) => clipboard )
272-
273- const store = useLogStore ( )
274- const settings = useSettingsStore ( )
275-
276- store . hasRemainingEntries = true
277- expect ( store . hasRemainingEntries ) . toBe ( true )
278-
279- await store . loadClipboard ( )
280-
281- // File parsed, so there are no remaining entries
282- expect ( store . hasRemainingEntries ) . toBe ( false )
283- expect ( window . navigator . clipboard . readText ) . toBeCalled ( )
284- expect ( window . prompt ) . toBeCalled ( )
285- expect ( settings . localFileName ) . toBe ( 'Clipboard' )
286- expect ( mocks . parseLogString ) . toBeCalledWith ( clipboard )
287- expect ( store . allEntries ) . toEqual ( [ { message : 'hello' } ] )
288- } )
289-
290258 it ( 'handles empty clipboard paste' , async ( ) => {
291259 // clean pinia
292260 createTestingPinia ( {
@@ -295,16 +263,13 @@ describe('store:logging', () => {
295263 stubActions : false ,
296264 } )
297265
298- window . navigator . clipboard . readText = vi . fn ( ( ) => Promise . reject ( new Error ( ) ) )
299- window . prompt = vi . fn ( ( ) => null )
300-
301266 const store = useLogStore ( )
302267 const settings = useSettingsStore ( )
303268
304269 store . hasRemainingEntries = true
305270 expect ( store . hasRemainingEntries ) . toBe ( true )
306271
307- await store . loadClipboard ( )
272+ await store . loadText ( '' )
308273
309274 // File parsed, so there are no remaining entries
310275 expect ( store . hasRemainingEntries ) . toBe ( true )
@@ -322,7 +287,6 @@ describe('store:logging', () => {
322287 stubActions : false ,
323288 } )
324289
325- window . navigator . clipboard . readText = vi . fn ( ( ) => Promise . resolve ( 'invalid' ) )
326290 // throw an error
327291 mocks . parseLogString . mockImplementationOnce ( ( ) => { throw new Error ( ) } )
328292
@@ -332,7 +296,7 @@ describe('store:logging', () => {
332296 store . hasRemainingEntries = true
333297 expect ( store . hasRemainingEntries ) . toBe ( true )
334298
335- await store . loadClipboard ( )
299+ await store . loadText ( 'invalid' )
336300
337301 // File parsed, so there are no remaining entries
338302 expect ( store . hasRemainingEntries ) . toBe ( true )
0 commit comments