Skip to content

Commit

Permalink
npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
campersau committed Feb 18, 2024
1 parent f78a862 commit a774cd7
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions clicktests/spec.authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const environment = require('./environment')({

describe('[AUTHENTICATION]', () => {
before('Environment init without temp folder', () => environment.init());

after('Environment stop', () => environment.shutdown());

it('Open home screen should show authentication dialog', async function () {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.bare.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('[BARE]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: true }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.branches.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('[BRANCHES]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: false }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('[COMMANDS]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: false }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
2 changes: 2 additions & 0 deletions clicktests/spec.discard.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('[DISCARD - noWarn]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: false }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand All @@ -58,6 +59,7 @@ describe('[DISCARD - withWarn]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: false }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('[GENERIC]', () => {
await rimraf(testRepoPaths[1]);
await mkdirp(testRepoPaths[1]);
});

after('Environment stop', () => environment.shutdown());

it('Open repo screen', () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.load-ahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('[LOAD-AHEAD]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: false }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.no-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('[NO-HEADER]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: false }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', async () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.remotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('[REMOTES]', () => {
await rimraf(testRepoPaths[2]); // clean clone test dir
await mkdirp(testRepoPaths[2]); // create clone test dir
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.stash.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('[STASH]', () => {
await environment.init();
await environment.createRepos(testRepoPaths, [{ bare: false, initCommits: 1 }]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
1 change: 1 addition & 0 deletions clicktests/spec.submodules.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('[SUMBODULES]', () => {
{ bare: false },
]);
});

after('Environment stop', () => environment.shutdown());

it('Open path screen', () => {
Expand Down
1 change: 1 addition & 0 deletions test/spec.git-api.branching.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('git-api branching', function () {
gitConfig = res;
});
});

after(() => common.post(req, '/testing/cleanup'));

const commitMessage = 'Commit 1';
Expand Down
1 change: 1 addition & 0 deletions test/spec.git-api.conflict-no-auto-stash.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('git-api conflict checkout no auto stash', function () {
);
});
});

after(() => {
return common.post(req, '/testing/cleanup');
});
Expand Down
21 changes: 21 additions & 0 deletions test/spec.git-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('git-parser parseDiffResult', () => {
"supertest": "~3.3.0"
`);
});

it('no diff selected', () => {
const gitDiff = dedent`
diff --git a/package.json b/package.json
Expand All @@ -69,6 +70,7 @@ describe('git-parser parseDiffResult', () => {

expect(gitParser.parsePatchDiffResult([false, false, false], gitDiff)).to.eql(null);
});

it('one +- diff selected', () => {
const gitDiff = dedent`
diff --git a/package.json b/package.json
Expand Down Expand Up @@ -103,6 +105,7 @@ describe('git-parser parseDiffResult', () => {
"supertest": "~3.3.0"
`);
});

it('only one + diff selected', () => {
const gitDiff = dedent`
diff --git a/package.json b/package.json
Expand All @@ -125,6 +128,7 @@ describe('git-parser parseDiffResult', () => {
'diff --git a/package.json b/package.json\nindex f71e0064..08964575 100644\n--- a/package.json\n+++ b/package.json\n@@ -87,9 +87,10 @@\n\t"grunt-mocha-test": "~0.13.3",\n\t"grunt-plato": "~1.4.0",\n\t"grunt-release": "~0.14.0",\n \t"istanbul": "~0.4.5",\n\t"mocha": "~5.2.0",\n\t"nightmare": "~3.0.1",\n+\t"nyc": "^13.1.0",\n\t"supertest": "~3.3.0"'
);
});

it('works with multiple diffs', () => {
const gitDiff = dedent`
diff --git a/README.md b/README.md
Expand All @@ -147,6 +151,7 @@ describe('git-parser parseDiffResult', () => {
'diff --git a/README.md b/README.md\nindex 96700c3a..dc141a51 100644\n--- a/README.md\n+++ b/README.md\n@@ -1,4 +1,3 @@\n-ungit\n======\n[![NPM version](https://badge.fury.io/js/ungit.svg)](http://badge.fury.io/js/ungit)\n[![Build Status](https://travis-ci.org/FredrikNoren/ungit.svg)](https://travis-ci.org/FredrikNoren/ungit)\n@@ -133,7 +132,7 @@ Changelog\nSee [CHANGELOG.md](CHANGELOG.md).\n\n License (MIT)\nSee [LICENSE.md](LICENSE.md). To read about the Faircode experiment go to [#974](https://github.com/FredrikNoren/ungit/issues/974). Ungit is now once again MIT.'
);
});

it('works with empty diff', () => {
expect(gitParser.parsePatchDiffResult([], null)).to.eql(null);
});
Expand All @@ -157,13 +162,16 @@ describe('git-parser parseGitLog', () => {
const refs = gitParser.parseGitLog('commit AAA BBB (HEAD, (test), fw(4rw), 5), ((, ()')[0].refs;
expect(refs.length).to.be(6);
});

it('should work with no branch name', () => {
const refs = gitParser.parseGitLog('commit AAA BBB')[0].refs;
expect(refs.length).to.be(0);
});

it('should work with empty lines', () => {
expect(gitParser.parseGitLog('')).to.eql([]);
});

it('parses authors without emails', () => {
const gitLog = dedent`
commit 37d1154434b70854ed243967e0d7e37aa3564551 d58c8e117fc257520d90b099fd2c6acd7c1e8861 (HEAD -> refs/heads/git-parser-specs)
Expand All @@ -184,6 +192,7 @@ describe('git-parser parseGitLog', () => {
sha1: '37d1154434b70854ed243967e0d7e37aa3564551',
});
});

it('parses multiple commits in a row', () => {
const gitLog = dedent(`
commit 5867e2766b0a0f81ad59ce9e9895d9b1a3523aa4 37d1154434b70854ed243967e0d7e37aa3564551 (HEAD -> refs/heads/git-parser-specs)
Expand Down Expand Up @@ -351,6 +360,7 @@ describe('git-parser parseGitLog', () => {
sha1: '621a04f931ea9007ac826c04a1a02832e20aa470',
});
});

it('parses multiple commits in a row multiple nul separators', () => {
const gitLog = dedent(`
commit ad4c559f05796e78095a51679324cefd9afca879 47185090d5096033db0d5c0bbf883d9295ca084e b360295026ae6afac3525b89145aa22d61e818ff (HEAD -> refs/heads/dev)
Expand Down Expand Up @@ -390,6 +400,7 @@ describe('git-parser parseGitLog', () => {
expect(res[2].message).to.eql('a');
expect(res[3].message).to.eql('Initial commit');
});

it('parses reflog commits without email', () => {
const gitLog = dedent(`
commit 37d11544 d58c8e11 (HEAD -> refs/heads/git-parser-specs)
Expand Down Expand Up @@ -433,6 +444,7 @@ describe('git-parser parseGitLog', () => {
sha1: '37d11544',
});
});

it('parses reflog commits', () => {
const gitLog = dedent(`
commit 37d11544 d58c8e11 (HEAD -> refs/heads/git-parser-specs)
Expand Down Expand Up @@ -477,6 +489,7 @@ describe('git-parser parseGitLog', () => {
sha1: '37d11544',
});
});

it('parses wrongly signed commits', () => {
const gitLog = dedent`
commit 37d1154434b70854ed243967e0d7e37aa3564551 d58c8e117fc257520d90b099fd2c6acd7c1e8861 (HEAD -> refs/heads/git-parser-specs)
Expand All @@ -500,6 +513,7 @@ describe('git-parser parseGitLog', () => {
sha1: '37d1154434b70854ed243967e0d7e37aa3564551',
});
});

it('parses signed commits', () => {
const gitLog = dedent`
commit 37d1154434b70854ed243967e0d7e37aa3564551 d58c8e117fc257520d90b099fd2c6acd7c1e8861 (HEAD -> refs/heads/git-parser-specs)
Expand All @@ -525,6 +539,7 @@ describe('git-parser parseGitLog', () => {
signatureMade: '"Test ungit (Git signing key) <[email protected]>"',
});
});

it('parses the git log', () => {
const gitLog = dedent(`
commit 37d1154434b70854ed243967e0d7e37aa3564551 d58c8e117fc257520d90b099fd2c6acd7c1e8861 (HEAD -> refs/heads/git-parser-specs)
Expand Down Expand Up @@ -571,6 +586,7 @@ describe('git-parser submodule', () => {
const submodules = gitParser.parseGitSubmodule(gitmodules);
expect(submodules).to.eql([]);
});

it('should work with name, path and url', () => {
const gitmodules = '[submodule "test1"]\npath = /path/to/sub1\nurl = http://example1.com';
const submodules = gitParser.parseGitSubmodule(gitmodules);
Expand All @@ -582,6 +598,7 @@ describe('git-parser submodule', () => {
url: 'http://example1.com',
});
});

it('should work with multiple name, path and url', () => {
const gitmodules = [
'[submodule "test1"]\npath = /path/to/sub1\nurl = http://example1.com',
Expand All @@ -602,6 +619,7 @@ describe('git-parser submodule', () => {
url: 'http://example2.com',
});
});

it('should work with multiple name, path, url, update, branch, fetchRecurseSubmodules and ignore', () => {
const gitmodules = [
'[submodule "test1"]\npath = /path/to/sub1\nurl = http://example1.com\nupdate = checkout\nbranch = master\nfetchRecurseSubmodules = true\nignore = all',
Expand All @@ -626,6 +644,7 @@ describe('git-parser submodule', () => {
url: 'http://example2.com',
});
});

it('should work with git submodules', () => {
const gitmodules = dedent`
[submodule "test1"]
Expand All @@ -650,6 +669,7 @@ describe('git-parser submodule', () => {
},
]);
});

it('should work with ssh submodules', () => {
const gitmodules = dedent`
[submodule "test1"]
Expand Down Expand Up @@ -772,6 +792,7 @@ describe('parseGitStatusNumstat', () => {
'test/spec.git-parser.js': { additions: '13', deletions: '0' },
});
});

it('skips empty lines', () => {
const gitStatusNumstat = dedent(`
1459 202 package-lock.json\x00
Expand Down

0 comments on commit a774cd7

Please sign in to comment.