Skip to content

Commit

Permalink
test: fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed May 28, 2020
1 parent d9253ac commit cbe8749
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
32 changes: 32 additions & 0 deletions lib/datasource/__snapshots__/metadata.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`datasource/metadata Should handle failed parsing of sourceUrls for GitLab 1`] = `
Object {
"releases": Array [
Object {
"releaseTimestamp": "2020-02-14T13:12:00",
"version": "5.7.0",
},
Object {
"releaseTimestamp": "2020-02-14T10:04:00",
"version": "5.6.1",
},
],
"sourceUrl": "https://gitlab-nope",
}
`;

exports[`datasource/metadata Should handle failed parsing of sourceUrls for other 1`] = `
Object {
"releases": Array [
Object {
"releaseTimestamp": "2020-02-14T13:12:00",
"version": "5.7.0",
},
Object {
"releaseTimestamp": "2020-02-14T10:04:00",
"version": "5.6.1",
},
],
"sourceUrl": "https://nope-nope-nope",
}
`;

exports[`datasource/metadata Should handle manualChangelogUrls 1`] = `
Object {
"changelogUrl": "https://github.com/django/django/tree/master/docs/releases",
Expand Down
34 changes: 34 additions & 0 deletions lib/datasource/metadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,40 @@ describe('datasource/metadata', () => {
addMetaData(dep, datasource, lookupName);
expect(dep).toMatchSnapshot();
});
it('Should handle failed parsing of sourceUrls for GitLab', () => {
const dep = {
sourceUrl: 'https://gitlab-nope',
releases: [
{ version: '5.7.0', releaseTimestamp: '2020-02-14T13:12:00' },
{
version: '5.6.1',
releaseTimestamp: '2020-02-14T10:04:00',
},
],
};
const datasource = datasourceNpm.id;
const lookupName = 'dropzone';

addMetaData(dep, datasource, lookupName);
expect(dep).toMatchSnapshot();
});
it('Should handle failed parsing of sourceUrls for other', () => {
const dep = {
sourceUrl: 'https://nope-nope-nope',
releases: [
{ version: '5.7.0', releaseTimestamp: '2020-02-14T13:12:00' },
{
version: '5.6.1',
releaseTimestamp: '2020-02-14T10:04:00',
},
],
};
const datasource = datasourceNpm.id;
const lookupName = 'dropzone';

addMetaData(dep, datasource, lookupName);
expect(dep).toMatchSnapshot();
});

it('Should handle parsing/converting of GitHub sourceUrls with http and www correctly', () => {
const dep = {
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/pr/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Array [
"gitLabAutomerge": false,
"statusCheckVerify": false,
},
"prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: At any time (no schedule defined).\\n\\n:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\n:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box",
"prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>someproject</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Renovate configuration\\n\\n:date: **Schedule**: At any time (no schedule defined).\\n\\n:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\n:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.\\n\\n:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box",
"prTitle": "Update dependency dummy to v1.1.0",
"useDefaultBranch": false,
},
Expand Down
2 changes: 2 additions & 0 deletions lib/workers/pr/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ describe('workers/pr', () => {
config.prCreation = 'status-success';
config.privateRepo = false;
config.logJSON = await getChangeLogJSON(config);
config.logJSON.project.gitlab = 'someproject';
delete config.logJSON.project.github;
const { prResult, pr } = await prWorker.ensurePr(config);
expect(prResult).toEqual(PrResult.Created);
expect(pr).toMatchObject({ displayNumber: 'New Pull Request' });
Expand Down

0 comments on commit cbe8749

Please sign in to comment.