File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { JSDOM } from "jsdom"
2
+ import { LocationLike } from "../../unit/util.test"
3
+
4
+ describe ( "login" , ( ) => {
5
+ // TODO test for when el is defined
6
+ describe . skip ( "when navigator and serviceWorker are NOT defined" , ( ) => {
7
+ it ( "should log an error" , ( ) => {
8
+ // Load service worker like you would in the browser
9
+ require ( "../../src/browser/register" )
10
+ } )
11
+ } )
12
+ // TODO test for when el is undefined
13
+ describe ( "there is no element with id 'base'" , ( ) => {
14
+ let initialDom : Document
15
+ beforeEach ( ( ) => {
16
+ const dom = new JSDOM ( )
17
+ initialDom = dom . window . document
18
+ global . document = dom . window . document
19
+
20
+ const location : LocationLike = {
21
+ pathname : "/healthz" ,
22
+ origin : "http://localhost:8080" ,
23
+ }
24
+
25
+ global . location = location as Location
26
+ } )
27
+ afterEach ( ( ) => {
28
+ // Reset the global.document
29
+ global . document = undefined as any as Document
30
+ } )
31
+ it ( "should not change the DOM" , ( ) => {
32
+ // Load file
33
+ require ( "../../../src/browser/pages/login" )
34
+ const currentDom = global . document
35
+ expect ( initialDom ) . toBe ( currentDom )
36
+ } )
37
+ } )
38
+ } )
You can’t perform that action at this time.
0 commit comments