|
1 | | -import fs from 'fs'; |
2 | 1 | import util from 'util'; |
3 | 2 | import { exec } from 'child_process'; |
4 | 3 | import { expect } from 'chai'; |
5 | 4 |
|
6 | 5 | import Proxy from '../../../src/proxy'; |
7 | | -import { Action } from '../../../src/proxy/actions/Action'; |
| 6 | +import { Action, Commit } from '../../../src/proxy/actions/Action'; |
8 | 7 | import { Step } from '../../../src/proxy/actions/Step'; |
9 | 8 | import { exec as execProcessor } from '../../../src/proxy/processors/push-action/audit'; |
10 | 9 | import * as db from '../../../src/db'; |
11 | | -import { Server } from 'http'; |
12 | 10 | import { Repo } from '../../../src/db/types'; |
13 | 11 | import service from '../../../src/service'; |
14 | 12 |
|
15 | 13 | const execAsync = util.promisify(exec); |
16 | 14 |
|
17 | | -// cookie file name |
18 | | -const GIT_PROXY_COOKIE_FILE = 'git-proxy-cookie'; |
19 | | - |
20 | 15 | /** |
21 | 16 | * @async |
22 | 17 | * @param {string} cli - The CLI command to be executed. |
@@ -131,26 +126,6 @@ async function closeServer(waitTime: number = 0) { |
131 | 126 | }); |
132 | 127 | } |
133 | 128 |
|
134 | | -/** |
135 | | - * Create local cookies file with an expired connect cookie. |
136 | | - */ |
137 | | -async function createCookiesFileWithExpiredCookie() { |
138 | | - await removeCookiesFile(); |
139 | | - const cookies = [ |
140 | | - 'connect.sid=s%3AuWjJK_VGFbX9-03UfvoSt_HFU3a0vFOd.jd986YQ17Bw4j1xGJn2l9yiF3QPYhayaYcDqGsNgQY4; Path=/; HttpOnly', |
141 | | - ]; |
142 | | - fs.writeFileSync(GIT_PROXY_COOKIE_FILE, JSON.stringify(cookies), 'utf8'); |
143 | | -} |
144 | | - |
145 | | -/** |
146 | | - * Remove local cookies file. |
147 | | - */ |
148 | | -async function removeCookiesFile() { |
149 | | - if (fs.existsSync(GIT_PROXY_COOKIE_FILE)) { |
150 | | - fs.unlinkSync(GIT_PROXY_COOKIE_FILE); |
151 | | - } |
152 | | -} |
153 | | - |
154 | 129 | /** |
155 | 130 | * Add a new repo to the database. |
156 | 131 | * @param {object} newRepo The new repo attributes. |
@@ -215,13 +190,13 @@ async function addGitPushToDb( |
215 | 190 | `\n\n\nGitProxy has received your push:\n\nhttp://localhost:8080/requests/${id}\n\n\n`, // blockedMessage |
216 | 191 | null, // content |
217 | 192 | ); |
218 | | - const commitData = []; |
| 193 | + const commitData: Commit[] = []; |
219 | 194 | commitData.push({ |
220 | 195 | tree: 'tree test', |
221 | 196 | parent: 'parent', |
222 | 197 | author: 'author', |
223 | 198 | committer: 'committer', |
224 | | - commitTs: 'commitTs', |
| 199 | + commitTimestamp: 'commitTimestamp', |
225 | 200 | message: 'message', |
226 | 201 | authorEmail: 'authorEmail', |
227 | 202 | committerEmail: 'committerEmail', |
@@ -283,6 +258,4 @@ export { |
283 | 258 | removeGitPushFromDb, |
284 | 259 | addUserToDb, |
285 | 260 | removeUserFromDb, |
286 | | - createCookiesFileWithExpiredCookie, |
287 | | - removeCookiesFile, |
288 | 261 | }; |
0 commit comments