11import assert from 'node:assert/strict'
22import path from 'node:path'
3- import { beforeEach , before , describe , it , mock } from 'node:test'
3+ import { beforeEach , before , describe , it , mock , afterEach } from 'node:test'
44import type { CommandDetail } from './lib/testHelpers.ts'
5- import { mockModule , mockCommandImplementation } from './lib/testHelpers.ts'
5+ import { mockCommandImplementation , mockModule } from './lib/testHelpers.ts'
66
7- // eslint-disable-next-line
8- describe . only ( 'deploy-prod-dc' , ( ) => {
7+ describe ( 'deploy-prod-dc' , ( ) => {
98 const commandMock = mock . fn ( )
10-
119 let commands : CommandDetail [ ]
1210
1311 before ( async ( ) => {
@@ -21,6 +19,10 @@ describe.only('deploy-prod-dc', () => {
2119 commands = mockCommandImplementation ( commandMock )
2220 } )
2321
22+ afterEach ( ( ) => {
23+ mock . restoreAll ( )
24+ } )
25+
2426 it ( 'should deploy a given datacenter' , async ( ) => {
2527 await runScript ( './deploy-prod-dc.ts' , 'v6' , 'us1' )
2628
@@ -42,22 +44,30 @@ describe.only('deploy-prod-dc', () => {
4244 ] )
4345 } )
4446
45- it ( 'should only check monitors before deploying if the upload path is root ' , async ( ) => {
46- await runScript ( './deploy-prod-dc.ts' , 'v6' , 'root ' , '--check-monitors' )
47+ it ( 'should deploy all minor datacenters ' , async ( ) => {
48+ await runScript ( './deploy-prod-dc.ts' , 'v6' , 'minor-dcs ' , '--no -check-monitors' )
4749
4850 assert . deepEqual ( commands , [
49- { command : 'node ./scripts/deploy/check-monitors.ts root' } ,
50- { command : 'node ./scripts/deploy/deploy.ts prod v6 root' } ,
51- { command : 'node ./scripts/deploy/upload-source-maps.ts v6 root' } ,
51+ { command : 'node ./scripts/deploy/deploy.ts prod v6 ap1,ap2,us3,us5' } ,
52+ { command : 'node ./scripts/deploy/upload-source-maps.ts v6 ap1,ap2,us3,us5' } ,
5253 ] )
5354 } )
5455
55- it ( 'should deploy all minor datacenters' , async ( ) => {
56- await runScript ( './deploy-prod-dc.ts' , 'v6' , 'minor-dcs' , '--no-check-monitors' )
56+ it ( 'should deploy all private regions' , async ( ) => {
57+ await runScript ( './deploy-prod-dc.ts' , 'v6' , 'private-regions' , '--no-check-monitors' )
58+
59+ assert . deepEqual ( commands , [
60+ { command : 'node ./scripts/deploy/deploy.ts prod v6 prtest00,prtest01' } ,
61+ { command : 'node ./scripts/deploy/upload-source-maps.ts v6 prtest00,prtest01' } ,
62+ ] )
63+ } )
64+
65+ it ( 'should deploy gov datacenters to the root upload path' , async ( ) => {
66+ await runScript ( './deploy-prod-dc.ts' , 'v6' , 'gov' , '--no-check-monitors' )
5767
5868 assert . deepEqual ( commands , [
59- { command : 'node ./scripts/deploy/deploy.ts prod v6 us3,us5,ap1,ap2,prtest00 ' } ,
60- { command : 'node ./scripts/deploy/upload-source-maps.ts v6 us3,us5,ap1,ap2,prtest00 ' } ,
69+ { command : 'node ./scripts/deploy/deploy.ts prod v6 root ' } ,
70+ { command : 'node ./scripts/deploy/upload-source-maps.ts v6 root ' } ,
6171 ] )
6272 } )
6373} )
0 commit comments