Skip to content

Commit

Permalink
test: verify that .remote folder is purged and timestamp instance of …
Browse files Browse the repository at this point in the history
…local clone #550
  • Loading branch information
JamieSlome committed May 10, 2024
1 parent 538b163 commit 7cc81ab
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/testClearBareClone.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const fs = require('fs');
const chai = require('chai');
const clearBareClone = require('../src/proxy/processors/push-action/clearBareClone').exec;
const pullRemote = require('../src/proxy/processors/push-action/pullRemote').exec;
const { Action } = require('../src/proxy/actions/Action');
chai.should();

const expect = chai.expect;
const timestamp = Date.now();

describe('clear bare and local clones', async () => {
it('pull remote generates a local .remote folder', async () => {
const action = new Action('123', 'type', 'get', timestamp, 'finos/git-proxy');
action.url = 'https://github.com/finos/git-proxy';
await pullRemote({}, action);

expect(fs.existsSync(`./.remote/${timestamp}`)).to.be.true;
});

it('clear bare clone function purges .remote folder and specific clone folder', async () => {
const action = new Action('123', 'type', 'get', timestamp, 'finos/git-proxy');
await clearBareClone(null, action);
expect(fs.existsSync(`./.remote`)).to.throw;
expect(fs.existsSync(`./.remote/${timestamp}`)).to.throw;
});
});

0 comments on commit 7cc81ab

Please sign in to comment.