renovate/lib/constants/platform.spec.ts

75 lines
2.9 KiB
TypeScript
Raw Normal View History

import { BitbucketTagsDatasource } from '../modules/datasource/bitbucket-tags';
import { GiteaTagsDatasource } from '../modules/datasource/gitea-tags';
import { GithubReleasesDatasource } from '../modules/datasource/github-releases';
import { GithubTagsDatasource } from '../modules/datasource/github-tags';
import { GitlabPackagesDatasource } from '../modules/datasource/gitlab-packages';
import { GitlabReleasesDatasource } from '../modules/datasource/gitlab-releases';
import { GitlabTagsDatasource } from '../modules/datasource/gitlab-tags';
feat: add datasource for Hermit package manager (#16257) * feat: add datasource for Hermit package manager * fix: make hermit datasource use http.stream instead of http.get * chore: inline small function and return null on error in hermit datasource * fix: use regExp to extract owner and repo from registryUrl * fix: use http from super & use error instead of debug on datasource error * fix: fix type check failure for github-release test * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * fix: wrap JSON.parse to avoid breaking process, plus more comment onto the search manifest streaming process * fix: add test to cover the invalid json case * fix: change some logger.errors to logger.warn in hermit datasource, error will exit the whole process * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * fix: use parseUrl and use hermit as GithubHttp id * fix: added test to include HermitDatasource type in GITHUB_API_USING_HOST_TYPES * fix: handle invalid url & achieve code coverage * fix: move url parsing to parent function * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * chore: clean up HermitDataSource class doc * fix: getHermitSearchManifest cache key function should expect undefined * fix: pass GetReleasesConfig into getHermitSearchManifest to get proper caching working * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore: fix json block in datasource readme.md * Put packageRules example in step 4 * fix: fix lint error * fix: pass parsedUrl into getHermitSearchManifest, add warning and simplifies type Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2022-07-15 03:57:05 -06:00
import { HermitDatasource } from '../modules/datasource/hermit';
import { PodDatasource } from '../modules/datasource/pod';
import { id as GITHUB_CHANGELOG_ID } from '../workers/repository/update/pr/changelog/github';
import { id as GITLAB_CHANGELOG_ID } from '../workers/repository/update/pr/changelog/gitlab';
import {
BITBUCKET_API_USING_HOST_TYPES,
GITEA_API_USING_HOST_TYPES,
GITHUB_API_USING_HOST_TYPES,
GITLAB_API_USING_HOST_TYPES,
} from './platforms';
describe('constants/platform', () => {
it('should be part of the GITEA_API_USING_HOST_TYPES', () => {
expect(
GITEA_API_USING_HOST_TYPES.includes(GiteaTagsDatasource.id),
).toBeTrue();
expect(GITEA_API_USING_HOST_TYPES.includes('gitea')).toBeTrue();
});
it('should be part of the GITLAB_API_USING_HOST_TYPES', () => {
expect(
GITLAB_API_USING_HOST_TYPES.includes(GitlabTagsDatasource.id),
).toBeTrue();
expect(
GITLAB_API_USING_HOST_TYPES.includes(GitlabReleasesDatasource.id),
).toBeTrue();
expect(
GITLAB_API_USING_HOST_TYPES.includes(GitlabPackagesDatasource.id),
).toBeTrue();
expect(
GITLAB_API_USING_HOST_TYPES.includes(GITLAB_CHANGELOG_ID),
).toBeTrue();
expect(GITLAB_API_USING_HOST_TYPES.includes('gitlab')).toBeTrue();
});
it('should be not part of the GITLAB_API_USING_HOST_TYPES ', () => {
expect(GITLAB_API_USING_HOST_TYPES.includes('github')).toBeFalse();
});
it('should be part of the GITHUB_API_USING_HOST_TYPES ', () => {
expect(
GITHUB_API_USING_HOST_TYPES.includes(GithubTagsDatasource.id),
).toBeTrue();
expect(
GITHUB_API_USING_HOST_TYPES.includes(GithubReleasesDatasource.id),
).toBeTrue();
expect(GITHUB_API_USING_HOST_TYPES.includes(PodDatasource.id)).toBeTrue();
feat: add datasource for Hermit package manager (#16257) * feat: add datasource for Hermit package manager * fix: make hermit datasource use http.stream instead of http.get * chore: inline small function and return null on error in hermit datasource * fix: use regExp to extract owner and repo from registryUrl * fix: use http from super & use error instead of debug on datasource error * fix: fix type check failure for github-release test * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * fix: wrap JSON.parse to avoid breaking process, plus more comment onto the search manifest streaming process * fix: add test to cover the invalid json case * fix: change some logger.errors to logger.warn in hermit datasource, error will exit the whole process * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * fix: use parseUrl and use hermit as GithubHttp id * fix: added test to include HermitDatasource type in GITHUB_API_USING_HOST_TYPES * fix: handle invalid url & achieve code coverage * fix: move url parsing to parent function * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * chore: clean up HermitDataSource class doc * fix: getHermitSearchManifest cache key function should expect undefined * fix: pass GetReleasesConfig into getHermitSearchManifest to get proper caching working * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore: fix json block in datasource readme.md * Put packageRules example in step 4 * fix: fix lint error * fix: pass parsedUrl into getHermitSearchManifest, add warning and simplifies type Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2022-07-15 03:57:05 -06:00
expect(
GITHUB_API_USING_HOST_TYPES.includes(HermitDatasource.id),
feat: add datasource for Hermit package manager (#16257) * feat: add datasource for Hermit package manager * fix: make hermit datasource use http.stream instead of http.get * chore: inline small function and return null on error in hermit datasource * fix: use regExp to extract owner and repo from registryUrl * fix: use http from super & use error instead of debug on datasource error * fix: fix type check failure for github-release test * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * fix: wrap JSON.parse to avoid breaking process, plus more comment onto the search manifest streaming process * fix: add test to cover the invalid json case * fix: change some logger.errors to logger.warn in hermit datasource, error will exit the whole process * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.spec.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * fix: use parseUrl and use hermit as GithubHttp id * fix: added test to include HermitDatasource type in GITHUB_API_USING_HOST_TYPES * fix: handle invalid url & achieve code coverage * fix: move url parsing to parent function * Update lib/modules/datasource/hermit/index.ts Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * chore: clean up HermitDataSource class doc * fix: getHermitSearchManifest cache key function should expect undefined * fix: pass GetReleasesConfig into getHermitSearchManifest to get proper caching working * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/modules/datasource/hermit/readme.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore: fix json block in datasource readme.md * Put packageRules example in step 4 * fix: fix lint error * fix: pass parsedUrl into getHermitSearchManifest, add warning and simplifies type Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2022-07-15 03:57:05 -06:00
).toBeTrue();
expect(
GITHUB_API_USING_HOST_TYPES.includes(GITHUB_CHANGELOG_ID),
).toBeTrue();
expect(GITHUB_API_USING_HOST_TYPES.includes('github')).toBeTrue();
});
it('should be not part of the GITHUB_API_USING_HOST_TYPES ', () => {
expect(GITHUB_API_USING_HOST_TYPES.includes('gitlab')).toBeFalse();
});
it('should be part of the BITBUCKET_API_USING_HOST_TYPES ', () => {
expect(
BITBUCKET_API_USING_HOST_TYPES.includes(BitbucketTagsDatasource.id),
).toBeTrue();
expect(BITBUCKET_API_USING_HOST_TYPES.includes('bitbucket')).toBeTrue();
});
});