@@ -62,7 +62,7 @@ describe("buildAndMaybePush", () => {
6262 buildCmd : [
6363 "build" ,
6464 "-t" ,
65- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
65+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
6666 "--platform" ,
6767 "linux/amd64" ,
6868 "--provenance=false" ,
@@ -73,7 +73,7 @@ describe("buildAndMaybePush", () => {
7373 dockerfile,
7474 } ) ;
7575 expect ( dockerImageInspect ) . toHaveBeenCalledWith ( "/custom/docker/path" , {
76- imageTag : `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
76+ imageTag : `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
7777 formatString :
7878 "{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}" ,
7979 } ) ;
@@ -94,7 +94,7 @@ describe("buildAndMaybePush", () => {
9494 buildCmd : [
9595 "build" ,
9696 "-t" ,
97- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
97+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
9898 "--platform" ,
9999 "linux/amd64" ,
100100 "--provenance=false" ,
@@ -104,14 +104,26 @@ describe("buildAndMaybePush", () => {
104104 ] ,
105105 dockerfile,
106106 } ) ;
107- expect ( runDockerCmd ) . toHaveBeenCalledTimes ( 1 ) ;
108- expect ( runDockerCmd ) . toHaveBeenCalledWith ( "docker" , [
107+
108+ // 3 calls: docker tag + docker push + docker rm
109+ expect ( runDockerCmd ) . toHaveBeenCalledTimes ( 3 ) ;
110+ expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 1 , "docker" , [
111+ "tag" ,
112+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
113+ `${ getCloudflareContainerRegistry ( ) } /some-account-id/test-app:tag` ,
114+ ] ) ;
115+ expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 2 , "docker" , [
109116 "push" ,
110117 `${ getCloudflareContainerRegistry ( ) } /some-account-id/test-app:tag` ,
111118 ] ) ;
119+ expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 3 , "docker" , [
120+ "image" ,
121+ "rm" ,
122+ `${ getCloudflareContainerRegistry ( ) } /some-account-id/test-app:tag` ,
123+ ] ) ;
112124 expect ( dockerImageInspect ) . toHaveBeenCalledOnce ( ) ;
113125 expect ( dockerImageInspect ) . toHaveBeenCalledWith ( "docker" , {
114- imageTag : `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
126+ imageTag : `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
115127 formatString :
116128 "{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}" ,
117129 } ) ;
@@ -121,7 +133,7 @@ describe("buildAndMaybePush", () => {
121133 it ( "should be able to build image and not push if it already exists in remote" , async ( ) => {
122134 vi . mocked ( runDockerCmd ) . mockResolvedValueOnce ( ) ;
123135 vi . mocked ( dockerImageInspect ) . mockResolvedValue (
124- '53387881 2 ["registry.cloudflare.com/some-account-id/ test-app@sha256:three"]'
136+ '53387881 2 ["registry.cloudflare.com/test-app@sha256:three"]'
125137 ) ;
126138 await runWrangler (
127139 "containers build ./container-context -t test-app:tag -p"
@@ -130,7 +142,7 @@ describe("buildAndMaybePush", () => {
130142 buildCmd : [
131143 "build" ,
132144 "-t" ,
133- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
145+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
134146 "--platform" ,
135147 "linux/amd64" ,
136148 "--provenance=false" ,
@@ -154,11 +166,11 @@ describe("buildAndMaybePush", () => {
154166 expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 2 , "docker" , [
155167 "image" ,
156168 "rm" ,
157- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
169+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
158170 ] ) ;
159171 expect ( dockerImageInspect ) . toHaveBeenCalledOnce ( ) ;
160172 expect ( dockerImageInspect ) . toHaveBeenCalledWith ( "docker" , {
161- imageTag : `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
173+ imageTag : `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
162174 formatString :
163175 "{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}" ,
164176 } ) ;
@@ -172,7 +184,7 @@ describe("buildAndMaybePush", () => {
172184 buildCmd : [
173185 "build" ,
174186 "-t" ,
175- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app` ,
187+ `${ getCloudflareContainerRegistry ( ) } /test-app` ,
176188 "--platform" ,
177189 "linux/amd64" ,
178190 "--provenance=false" ,
@@ -194,7 +206,7 @@ describe("buildAndMaybePush", () => {
194206 buildCmd : [
195207 "build" ,
196208 "-t" ,
197- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app` ,
209+ `${ getCloudflareContainerRegistry ( ) } /test-app` ,
198210 "--platform" ,
199211 "linux/amd64" ,
200212 "--provenance=false" ,
@@ -270,27 +282,24 @@ describe("buildAndMaybePush", () => {
270282 } ) ;
271283
272284 describe ( "resolveAppDiskSize" , ( ) => {
273- const accountBase = {
274- limits : { disk_mb_per_deployment : 2000 } ,
275- } as CompleteAccountCustomer ;
276285 it ( "should return parsed app disk size" , ( ) => {
277- const result = resolveAppDiskSize ( accountBase , {
286+ const result = resolveAppDiskSize ( {
278287 ...defaultConfiguration ,
279288 configuration : { image : "" , disk : { size : "500MB" } } ,
280289 } ) ;
281290 expect ( result ) . toBeCloseTo ( 500 * 1000 * 1000 , - 5 ) ;
282291 } ) ;
283292
284293 it ( "should return default size when disk size not set" , ( ) => {
285- const result = resolveAppDiskSize ( accountBase , {
294+ const result = resolveAppDiskSize ( {
286295 ...defaultConfiguration ,
287296 configuration : { image : "" } ,
288297 } ) ;
289298 expect ( result ) . toBeCloseTo ( 2 * 1000 * 1000 * 1000 , - 5 ) ;
290299 } ) ;
291300
292301 it ( "should return undefined if app is not passed" , ( ) => {
293- expect ( resolveAppDiskSize ( accountBase , undefined ) ) . toBeUndefined ( ) ;
302+ expect ( resolveAppDiskSize ( undefined ) ) . toBeUndefined ( ) ;
294303 } ) ;
295304 } ) ;
296305} ) ;
0 commit comments