@@ -92,6 +92,23 @@ describe("plugin", () => {
9292 } ) ;
9393 } ) ;
9494
95+ test ( "image pulled by tag has version set" , async ( ) => {
96+ const imageNameAndTag = `nginx:1.19.0` ;
97+
98+ const pluginResult = await plugin . scan ( {
99+ path : imageNameAndTag ,
100+ } ) ;
101+
102+ const depGraph : DepGraph = pluginResult . scanResults [ 0 ] . facts . find (
103+ ( fact ) => fact . type === "depGraph" ,
104+ ) ! . data ;
105+
106+ // image name matches
107+ expect ( depGraph . rootPkg . name ) . toEqual ( "docker-image|nginx" ) ;
108+ // version must not be empty
109+ expect ( depGraph . rootPkg . version ) . toEqual ( "1.19.0" ) ;
110+ } ) ;
111+
95112 describe ( "when scanning a locally loaded image" , ( ) => {
96113 const imageName = "busybox" ;
97114 const imageTag = "latest" ;
@@ -121,23 +138,6 @@ describe("plugin", () => {
121138 } ) ;
122139 } ) ;
123140
124- test ( "image pulled by tag has version set" , async ( ) => {
125- const imageNameAndTag = `nginx:1.19.0` ;
126-
127- const pluginResult = await plugin . scan ( {
128- path : imageNameAndTag ,
129- } ) ;
130-
131- const depGraph : DepGraph = pluginResult . scanResults [ 0 ] . facts . find (
132- ( fact ) => fact . type === "depGraph" ,
133- ) ! . data ;
134-
135- // image name matches
136- expect ( depGraph . rootPkg . name ) . toEqual ( "docker-image|nginx" ) ;
137- // version must not be empty
138- expect ( depGraph . rootPkg . version ) . toEqual ( "1.19.0" ) ;
139- } ) ;
140-
141141 test ( "static scan for Identifier type image (nginx:1.19.0)" , async ( ) => {
142142 // This digest resolves to the `1.19.0` tag. We're using the digest to guarantee we always get the correct
143143 // image, no matter on which platform this test is run on.
0 commit comments