Skip to content

Commit 4434fd0

Browse files
committed
Fix tests
1 parent f5769af commit 4434fd0

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

actions/cursor-deploy/index.test.ts

+21-21
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ describe(`Cursor Deploy Action`, () => {
1919
And the tree hash used is the current repo tree hash
2020
`,
2121
async () => {
22-
const treeHash = 'b017ebdf289ba78787da4e9c3291f0b7959e7059'
23-
mockedUtils.getCurrentRepoTreeHash.mockResolvedValue(treeHash)
22+
const deployHash = 'b017ebdf289ba78787da4e9c3291f0b7959e7059'
23+
mockedUtils.readFileFromS3.mockResolvedValue(deployHash)
2424
mockedUtils.fileExistsInS3.mockResolvedValue(false)
2525

2626
const output = await cursorDeploy({
@@ -33,13 +33,13 @@ describe(`Cursor Deploy Action`, () => {
3333
expectRollbackFileChecked('my-bucket', 'rollbacks/main')
3434

3535
expectCursorFileUpdated({
36-
treeHash: treeHash,
36+
deployHash: deployHash,
3737
branch: 'main',
3838
bucket: 'my-bucket',
3939
key: 'deploys/main'
4040
})
4141

42-
expect(output.treeHash).toBe(treeHash)
42+
expect(output.deployHash).toBe(deployHash)
4343
expect(output.branchLabel).toBe('main')
4444
}
4545
)
@@ -53,9 +53,9 @@ describe(`Cursor Deploy Action`, () => {
5353
And the tree hash used is the current repo tree hash
5454
`,
5555
async () => {
56-
const treeHash = '553b0cb96ac21ffc0583e5d8d72343b1faa90dfd'
56+
const deployHash = '553b0cb96ac21ffc0583e5d8d72343b1faa90dfd'
5757
const sanitizedBranch = 'lol-my-feature-branch-30-better'
58-
mockedUtils.getCurrentRepoTreeHash.mockResolvedValue(treeHash)
58+
mockedUtils.readFileFromS3.mockResolvedValue(deployHash)
5959
mockedUtils.fileExistsInS3.mockResolvedValue(false)
6060

6161
const output = await cursorDeploy({
@@ -68,13 +68,13 @@ describe(`Cursor Deploy Action`, () => {
6868
expectRollbackFileChecked('my-bucket', 'rollbacks/lol-my-feature-branch-30-better')
6969

7070
expectCursorFileUpdated({
71-
treeHash: treeHash,
71+
deployHash: deployHash,
7272
branch: sanitizedBranch,
7373
bucket: 'my-bucket',
7474
key: 'deploys/lol-my-feature-branch-30-better'
7575
})
7676

77-
expect(output.treeHash).toBe(treeHash)
77+
expect(output.deployHash).toBe(deployHash)
7878
expect(output.branchLabel).toBe(sanitizedBranch)
7979
}
8080
)
@@ -87,8 +87,8 @@ describe(`Cursor Deploy Action`, () => {
8787
And the action returns a error
8888
`,
8989
async () => {
90-
const treeHash = 'b017ebdf289ba78787da4e9c3291f0b7959e7059'
91-
mockedUtils.getCurrentRepoTreeHash.mockResolvedValue(treeHash)
90+
const deployHash = 'b017ebdf289ba78787da4e9c3291f0b7959e7059'
91+
mockedUtils.readFileFromS3.mockResolvedValue(deployHash)
9292
mockedUtils.fileExistsInS3.mockResolvedValue(true)
9393

9494
const promise = cursorDeploy({
@@ -121,7 +121,7 @@ describe(`Cursor Deploy Action`, () => {
121121
const currentTreeHash = 'b017ebdf289ba78787da4e9c3291f0b7959e7059'
122122
const commitTreeHash = '32439d157a7e346d117a6a3c47d511526bd45012'
123123

124-
mockedUtils.getCurrentRepoTreeHash.mockResolvedValue(currentTreeHash)
124+
mockedUtils.readFileFromS3.mockResolvedValue(currentTreeHash)
125125
mockedUtils.fileExistsInS3.mockResolvedValue(false)
126126
mockedUtils.getTreeHashForCommitHash.mockResolvedValue(commitTreeHash)
127127

@@ -155,7 +155,7 @@ describe(`Cursor Deploy Action`, () => {
155155
key: 'rollbacks/main'
156156
})
157157

158-
expect(output.treeHash).toBe(commitTreeHash)
158+
expect(output.deployHash).toBe(commitTreeHash)
159159
expect(output.branchLabel).toBe('main')
160160
}
161161
)
@@ -172,7 +172,7 @@ describe(`Cursor Deploy Action`, () => {
172172
const commitTreeHash = 'b6e1c0468f4705b8cd0f18a04cd28ef7b9da7425'
173173
const commitHash = 'fc24d309398cbf6d53237e05e4d2a8cd2de57cc7'
174174

175-
mockedUtils.getCurrentRepoTreeHash.mockResolvedValue(currentTreeHash)
175+
mockedUtils.readFileFromS3.mockResolvedValue(currentTreeHash)
176176
mockedUtils.fileExistsInS3.mockResolvedValue(false)
177177
mockedUtils.isHeadAncestor.mockResolvedValue(true)
178178
mockedUtils.getTreeHashForCommitHash.mockResolvedValue(commitTreeHash)
@@ -207,7 +207,7 @@ describe(`Cursor Deploy Action`, () => {
207207
key: 'rollbacks/main'
208208
})
209209

210-
expect(output.treeHash).toBe(commitTreeHash)
210+
expect(output.deployHash).toBe(commitTreeHash)
211211
expect(output.branchLabel).toBe('main')
212212
}
213213
)
@@ -221,9 +221,9 @@ describe(`Cursor Deploy Action`, () => {
221221
And the tree hash used is the tree hash of the passed commit hash
222222
`,
223223
async () => {
224-
const treeHash = 'b017ebdf289ba78787da4e9c3291f0b7959e7059'
224+
const deployHash = 'b017ebdf289ba78787da4e9c3291f0b7959e7059'
225225

226-
mockedUtils.getCurrentRepoTreeHash.mockResolvedValue(treeHash)
226+
mockedUtils.readFileFromS3.mockResolvedValue(deployHash)
227227
mockedUtils.fileExistsInS3.mockResolvedValue(true)
228228
mockedUtils.isHeadAncestor.mockResolvedValue(true)
229229

@@ -237,7 +237,7 @@ describe(`Cursor Deploy Action`, () => {
237237
expectRollbackFileChecked('my-bucket', 'rollbacks/main')
238238

239239
expectCursorFileUpdated({
240-
treeHash: treeHash,
240+
deployHash: deployHash,
241241
branch: 'main',
242242
bucket: 'my-bucket',
243243
key: 'deploys/main'
@@ -248,7 +248,7 @@ describe(`Cursor Deploy Action`, () => {
248248
key: 'rollbacks/main'
249249
})
250250

251-
expect(output.treeHash).toBe(treeHash)
251+
expect(output.deployHash).toBe(deployHash)
252252
expect(output.branchLabel).toBe('main')
253253
}
254254
)
@@ -286,7 +286,7 @@ describe(`Cursor Deploy Action`, () => {
286286
const commitHash = 'fc24d309398cbf6d53237e05e4d2a8cd2de57cc7'
287287
const commitTreeHash = 'b6e1c0468f4705b8cd0f18a04cd28ef7b9da7425'
288288

289-
mockedUtils.getCurrentRepoTreeHash.mockResolvedValue(currentTreeHash)
289+
mockedUtils.readFileFromS3.mockResolvedValue(currentTreeHash)
290290
mockedUtils.fileExistsInS3.mockResolvedValue(false)
291291
mockedUtils.isHeadAncestor.mockResolvedValue(false)
292292
mockedUtils.getTreeHashForCommitHash.mockResolvedValue(commitTreeHash)
@@ -370,14 +370,14 @@ describe('Branch Sanitize - branchNameToHostnameLabel', () => {
370370
//#region Custom Assertions
371371

372372
function expectCursorFileUpdated(args: {
373-
treeHash: string
373+
deployHash: string
374374
branch: string
375375
bucket: string
376376
key: string
377377
}) {
378378
expect(mockedUtils.writeLineToFile).toHaveBeenCalledTimes(1)
379379
expect(mockedUtils.writeLineToFile).toHaveBeenCalledWith({
380-
text: args.treeHash,
380+
text: args.deployHash,
381381
path: args.branch
382382
})
383383

0 commit comments

Comments
 (0)