Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6104acb

Browse files
committed
(refactor/test): only ignore parts of AsyncLocalStorage
- instead of the whole file, just clear and removeItem, as those two aren't currently used internally - have to use this funky style comment-in-the-middle-of-function- declaration for now as it won't ignore the func otherwise, possibly because of how it gets transpiled down to ES5- invalid usage of localStorage functions also isn't done internally, so ignore the catch / Promise.reject block as well
1 parent2b4b78a commit6104acb

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

‎jest.config.js‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎src/asyncLocalStorage.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// using istanbul ignore on portions of code that are not currently used internally
2+
13
interfaceIAsyncLocalStorage{
24
clear():Promise<void>
35
getItem(key:string):Promise<string>
@@ -7,13 +9,13 @@ interface IAsyncLocalStorage {
79

810
exportconstAsyncLocalStorage:IAsyncLocalStorage={
911
// must use wrapper functions when passing localStorage functions (https://github.com/agilgur5/mst-persist/issues/18)
10-
clear(){
12+
clear/* istanbul ignore next */(){
1113
returncallWithPromise(()=>window.localStorage.clear())
1214
},
1315
getItem(key){
1416
returncallWithPromise(()=>window.localStorage.getItem(key))
1517
},
16-
removeItem(key){
18+
removeItem/* istanbul ignore next */(key){
1719
returncallWithPromise(()=>window.localStorage.removeItem(key))
1820
},
1921
setItem(key,value){
@@ -25,6 +27,7 @@ function callWithPromise (func: Function, ...args: any[]): Promise<any> {
2527
try{
2628
returnPromise.resolve(func(...args))
2729
}catch(err){
30+
/* istanbul ignore next */
2831
returnPromise.reject(err)
2932
}
3033
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp