Skip to content

Commit ee4de06

Browse files
committed
chore: remove unused cookie management from testCliUtils
1 parent 17a18dd commit ee4de06

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

packages/git-proxy-cli/test/testCliUtils.ts

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
import fs from 'fs';
21
import util from 'util';
32
import { exec } from 'child_process';
43
import { expect } from 'chai';
54

65
import Proxy from '../../../src/proxy';
7-
import { Action } from '../../../src/proxy/actions/Action';
6+
import { Action, Commit } from '../../../src/proxy/actions/Action';
87
import { Step } from '../../../src/proxy/actions/Step';
98
import { exec as execProcessor } from '../../../src/proxy/processors/push-action/audit';
109
import * as db from '../../../src/db';
11-
import { Server } from 'http';
1210
import { Repo } from '../../../src/db/types';
1311
import service from '../../../src/service';
1412

1513
const execAsync = util.promisify(exec);
1614

17-
// cookie file name
18-
const GIT_PROXY_COOKIE_FILE = 'git-proxy-cookie';
19-
2015
/**
2116
* @async
2217
* @param {string} cli - The CLI command to be executed.
@@ -131,26 +126,6 @@ async function closeServer(waitTime: number = 0) {
131126
});
132127
}
133128

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-
154129
/**
155130
* Add a new repo to the database.
156131
* @param {object} newRepo The new repo attributes.
@@ -215,13 +190,13 @@ async function addGitPushToDb(
215190
`\n\n\nGitProxy has received your push:\n\nhttp://localhost:8080/requests/${id}\n\n\n`, // blockedMessage
216191
null, // content
217192
);
218-
const commitData = [];
193+
const commitData: Commit[] = [];
219194
commitData.push({
220195
tree: 'tree test',
221196
parent: 'parent',
222197
author: 'author',
223198
committer: 'committer',
224-
commitTs: 'commitTs',
199+
commitTimestamp: 'commitTimestamp',
225200
message: 'message',
226201
authorEmail: 'authorEmail',
227202
committerEmail: 'committerEmail',
@@ -283,6 +258,4 @@ export {
283258
removeGitPushFromDb,
284259
addUserToDb,
285260
removeUserFromDb,
286-
createCookiesFileWithExpiredCookie,
287-
removeCookiesFile,
288261
};

0 commit comments

Comments
 (0)