[ 
https://issues.apache.org/jira/browse/FLAGON-451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16929013#comment-16929013
 ] 

Joshua Poore commented on FLAGON-451:
-------------------------------------

Other observations:
 # same error regardless if sessionStorage mock is added to 1 test or all 6 
failing tests
 # error message reads 'sessionStorage is undefined' if window. is stripped 
from window.sessionStorage. This is likely because dom-storage isn't being 
added to jsdom properly, but jsdom-global is mocking global objects like 
'window' (doesn't mock session storage).
 # have tried using dom-storage in both strict:true & false, to see if there is 
a stringification issue in pulling key:values from storage. Doesn't seem to 
affect anything (passing in strings anyway). 
 # have tried invoking dom-storage API to .setItem as a string integer, to rule 
out possibility that time functions (to produce sessionIds) are breaking tests 
in jsdom env.

Clearly, I'm just not passing the sessionStorage mock into the jsdom 
environment correctly.

> Update unit tests to accommodate session storage features
> ---------------------------------------------------------
>
>                 Key: FLAGON-451
>                 URL: https://issues.apache.org/jira/browse/FLAGON-451
>             Project: Flagon
>          Issue Type: Sub-task
>          Components: UserALE.js
>    Affects Versions: UserALE.js 2.1.0
>            Reporter: Joshua Poore
>            Assignee: Joshua Poore
>            Priority: Major
>             Fix For: UserALE.js 2.1.0
>
>
> session storage needs to be a known object in unit tests.
> exercising sessionStorage in getInitialSettings to preserve session Id at 
> page refresh (such as submit) performs expectedly in testing with the example 
> page, however breaks the following unit tests:
> {code:java}
>   1) getInitialSettings
>        getInitialSettings
>          fetches all settings from a script tag:
>      Uncaught TypeError: Cannot read property 'options' of undefined
>       at Object.done (test/getInitialSettings_spec.js:76:39)
>       at 
> /Users/jpoore/Documents/Apache_Flagon/test/incubator-flagon-useralejs/node_modules/jsdom/lib/jsdom.js:325:18
>       at processTicksAndRejections (internal/process/task_queues.js:75:11)
>   2) getInitialSettings
>        getInitialSettings
>          grabs user id from params:
>      Uncaught TypeError: Cannot read property 'options' of undefined
>       at Object.url [as done] (test/getInitialSettings_spec.js:95:39)
>       at 
> /Users/jpoore/Documents/Apache_Flagon/test/incubator-flagon-useralejs/node_modules/jsdom/lib/jsdom.js:325:18
>       at processTicksAndRejections (internal/process/task_queues.js:75:11)
>   3) Userale API
>        provides configs:
>      Uncaught TypeError: Cannot read property 'options' of undefined
>       at Object.done (test/main_spec.js:33:37)
>       at 
> /Users/jpoore/Documents/Apache_Flagon/test/incubator-flagon-useralejs/node_modules/jsdom/lib/jsdom.js:325:18
>       at processTicksAndRejections (internal/process/task_queues.js:75:11)
>   4) Userale API
>        edits configs:
>      Uncaught TypeError: Cannot read property 'options' of undefined
>       at Object.done (test/main_spec.js:58:37)
>       at 
> /Users/jpoore/Documents/Apache_Flagon/test/incubator-flagon-useralejs/node_modules/jsdom/lib/jsdom.js:325:18
>       at processTicksAndRejections (internal/process/task_queues.js:75:11)
>   5) Userale API
>        starts + stops:
>      Uncaught TypeError: Cannot read property 'options' of undefined
>       at Timeout._onTimeout (test/main_spec.js:75:24)
>       at listOnTimeout (internal/timers.js:531:17)
>       at processTimers (internal/timers.js:475:7)
>   6) Userale API
>        sends custom logs:
>      Uncaught TypeError: Cannot read property 'log' of undefined
>       at Object.done (test/main_spec.js:93:22)
>       at 
> /Users/jpoore/Documents/Apache_Flagon/test/incubator-flagon-useralejs/node_modules/jsdom/lib/jsdom.js:325:18
>       at processTicksAndRejections 
> (internal/process/task_queues.js:75:11){code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to