@@ -10,7 +10,7 @@ import {
1010 it
1111} from '@jest/globals' ;
1212
13- import { checkForRepoUpdates , setUpdateButtonDisplay } from '../utils' ;
13+ import { checkForRepoUpdates , setUpdateButtonDisplay , WidgetState } from '../utils' ;
1414
1515describe ( 'nbgitpuller-jl-interface utils checkForRepoUpdates' , ( ) => {
1616 beforeEach ( ( ) => { } ) ;
@@ -134,36 +134,41 @@ describe('nbgitpuller-jl-interface utils setUpdateButtonDisplay', () => {
134134 document . body . innerHTML = '' ;
135135 } ) ;
136136
137- it ( 'widget up to date populated ' , async ( ) => {
137+ it ( 'widget up to date success ' , async ( ) => {
138138 const widget = await document . createElement ( 'div' ) ;
139139 widget . id = 'nbgitpuller-jl-interface-update-btn' ;
140140 document . body . appendChild ( widget ) ;
141141
142- const returnValue = await setUpdateButtonDisplay ( true , '' , [
143- { repoUrl : 'https://fakerepo.com' , branch : 'main' , destPath : 'mypath' }
144- ] ) ;
142+ const returnValue = await setUpdateButtonDisplay ( WidgetState . UpToDate , '' ) ;
145143
146144 expect ( returnValue ) . toStrictEqual ( { error : '' , returncode : 0 } ) ;
147145 expect ( widget . innerHTML ) . toContain ( `<span class="success">◉</span>` ) ;
148146 } ) ;
149147
150- it ( 'widget update needed populated ' , async ( ) => {
148+ it ( 'widget update required ' , async ( ) => {
151149 const widget = await document . createElement ( 'div' ) ;
152150 widget . id = 'nbgitpuller-jl-interface-update-btn' ;
153151 document . body . appendChild ( widget ) ;
154152
155- const returnValue = await setUpdateButtonDisplay ( false , '' , [
156- { repoUrl : 'https://fakerepo.com' , branch : 'main' , destPath : 'mypath' }
157- ] ) ;
153+ const returnValue = await setUpdateButtonDisplay ( WidgetState . UpdateRequired , '' ) ;
154+
155+ expect ( returnValue ) . toStrictEqual ( { error : '' , returncode : 0 } ) ;
156+ expect ( widget . innerHTML ) . toContain ( `<span class="pending blink">◉</span>` ) ;
157+ } ) ;
158+
159+ it ( 'widget error' , async ( ) => {
160+ const widget = await document . createElement ( 'div' ) ;
161+ widget . id = 'nbgitpuller-jl-interface-update-btn' ;
162+ document . body . appendChild ( widget ) ;
163+
164+ const returnValue = await setUpdateButtonDisplay ( WidgetState . Error , '' ) ;
158165
159166 expect ( returnValue ) . toStrictEqual ( { error : '' , returncode : 0 } ) ;
160167 expect ( widget . innerHTML ) . toContain ( `<span class="failure blink">◉</span>` ) ;
161168 } ) ;
162169
163170 it ( 'widget not found' , async ( ) => {
164- const returnValue = await setUpdateButtonDisplay ( false , '' , [
165- { repoUrl : 'https://fakerepo.com' , branch : 'main' , destPath : 'mypath' }
166- ] ) ;
171+ const returnValue = await setUpdateButtonDisplay ( WidgetState . Error , '' ) ;
167172
168173 expect ( returnValue ) . toStrictEqual ( {
169174 error : 'Unable to find nbgitpuller widget' ,
0 commit comments