@@ -7,13 +7,24 @@ import type {Logger} from "../src/logger.js";
7
7
import { commandRequiresAuthenticationMessage } from "../src/observableApiAuth.js" ;
8
8
import type { DeployConfig } from "../src/observableApiConfig.js" ;
9
9
import { MockLogger } from "./mocks/logger.js" ;
10
- import {
11
- ObservableApiMock ,
12
- invalidApiKey ,
13
- userWithTwoWorkspaces ,
14
- userWithZeroWorkspaces ,
15
- validApiKey
16
- } from "./mocks/observableApi.js" ;
10
+ import { ObservableApiMock } from "./mocks/observableApi.js" ;
11
+ import { invalidApiKey , userWithTwoWorkspaces , userWithZeroWorkspaces , validApiKey } from "./mocks/observableApi.js" ;
12
+
13
+ // These files are implicitly generated by the CLI. This may change over time,
14
+ // so they’re enumerated here for clarity. TODO We should enforce that these
15
+ // files are specifically uploaded, rather than just the number of files.
16
+ const EXTRA_FILES : string [ ] = [
17
+ "_observablehq/client.js" ,
18
+ "_observablehq/runtime.js" ,
19
+ "_observablehq/stdlib.js" ,
20
+ "_observablehq/stdlib/dot.js" ,
21
+ "_observablehq/stdlib/duckdb.js" ,
22
+ "_observablehq/stdlib/mermaid.js" ,
23
+ "_observablehq/stdlib/sqlite.js" ,
24
+ "_observablehq/stdlib/tex.js" ,
25
+ "_observablehq/stdlib/xslx.js" ,
26
+ "_observablehq/style.css"
27
+ ] ;
17
28
18
29
class MockDeployEffects implements DeployEffects {
19
30
public logger = new MockLogger ( ) ;
@@ -67,7 +78,9 @@ class MockDeployEffects implements DeployEffects {
67
78
}
68
79
}
69
80
70
- const TEST_SOURCE_ROOT = "test/example-dist" ;
81
+ // This test should have exactly one index.md in it, and nothing else; that one
82
+ // page is why we +1 to the number of extra files.
83
+ const TEST_SOURCE_ROOT = "test/input/build/simple-public" ;
71
84
72
85
describe ( "deploy" , ( ) => {
73
86
it ( "makes expected API calls for a new project" , async ( ) => {
@@ -77,7 +90,7 @@ describe("deploy", () => {
77
90
. handleGetUser ( )
78
91
. handlePostProject ( { projectId} )
79
92
. handlePostDeploy ( { projectId, deployId} )
80
- . handlePostDeployFile ( { deployId, repeat : 3 } )
93
+ . handlePostDeployFile ( { deployId, repeat : EXTRA_FILES . length + 1 } )
81
94
. handlePostDeployUploaded ( { deployId} )
82
95
. start ( ) ;
83
96
@@ -96,7 +109,7 @@ describe("deploy", () => {
96
109
const deployId = "deploy456" ;
97
110
const apiMock = new ObservableApiMock ( )
98
111
. handlePostDeploy ( { projectId, deployId} )
99
- . handlePostDeployFile ( { deployId, repeat : 3 } )
112
+ . handlePostDeployFile ( { deployId, repeat : EXTRA_FILES . length + 1 } )
100
113
. handlePostDeployUploaded ( { deployId} )
101
114
. start ( ) ;
102
115
@@ -129,7 +142,7 @@ describe("deploy", () => {
129
142
. handleGetUser ( { user : userWithTwoWorkspaces } )
130
143
. handlePostProject ( { projectId} )
131
144
. handlePostDeploy ( { projectId, deployId} )
132
- . handlePostDeployFile ( { deployId, repeat : 3 } )
145
+ . handlePostDeployFile ( { deployId, repeat : EXTRA_FILES . length + 1 } )
133
146
. handlePostDeployUploaded ( { deployId} )
134
147
. start ( ) ;
135
148
const effects = new MockDeployEffects ( ) ;
@@ -232,7 +245,7 @@ describe("deploy", () => {
232
245
. handleGetUser ( )
233
246
. handlePostProject ( { projectId} )
234
247
. handlePostDeploy ( { projectId, deployId} )
235
- . handlePostDeployFile ( { deployId, repeat : 3 } )
248
+ . handlePostDeployFile ( { deployId, repeat : EXTRA_FILES . length + 1 } )
236
249
. handlePostDeployUploaded ( { deployId, status : 500 } )
237
250
. start ( ) ;
238
251
const effects = new MockDeployEffects ( ) ;
0 commit comments