refactor: Test snapshots for azure-pipelines and bazel (#11244)

This commit is contained in:
Sergei Zharinov 2021-08-13 09:15:34 +03:00 committed by GitHub
parent 6fd568215b
commit 1b395fc95f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 11 deletions

View file

@ -27,14 +27,16 @@ describe(getName(), () => {
describe('extractRepository()', () => {
it('should extract repository information', () => {
// FIXME: explicit assert condition
expect(
extractRepository({
type: 'github',
name: 'user/repo',
ref: 'refs/tags/v1.0.0',
})
).toMatchSnapshot();
).toMatchSnapshot({
depName: 'user/repo',
lookupName: 'https://github.com/user/repo.git',
});
});
it('should return null when repository type is not github', () => {
@ -75,7 +77,11 @@ describe(getName(), () => {
extractContainer({
image: 'ubuntu:16.04',
})
).toMatchSnapshot();
).toMatchSnapshot({
depName: 'ubuntu',
currentValue: '16.04',
datasource: 'docker',
});
});
it('should return null if image field is missing', () => {
expect(extractContainer({ image: null })).toBeNull();

View file

@ -23,18 +23,29 @@ describe(getName(), () => {
});
it('extracts github tags', () => {
const res = extractPackageFile(workspace2File);
// FIXME: explicit assert condition
expect(res.deps).toMatchSnapshot();
expect(res.deps).toMatchSnapshot([
{ lookupName: 'lmirosevic/GBDeviceInfo' },
{ lookupName: 'nelhage/rules_boost' },
{ lookupName: 'lmirosevic/GBDeviceInfo' },
{ lookupName: 'nelhage/rules_boost' },
]);
});
it('handle comments and strings', () => {
const res = extractPackageFile(workspace3File);
// FIXME: explicit assert condition
expect(res.deps).toMatchSnapshot();
expect(res.deps).toMatchSnapshot([{ lookupName: 'nelhage/rules_boost' }]);
});
it('extracts dependencies from *.bzl files', () => {
const res = extractPackageFile(fileWithBzlExtension);
// FIXME: explicit assert condition
expect(res.deps).toMatchSnapshot();
expect(res.deps).toMatchSnapshot([
{
currentDigest: '0356bef3fbbabec5f0e196ecfacdeb6db62d48c0',
lookupName: 'google/subpar',
},
{
currentValue: '0.6.0',
lookupName: 'bazelbuild/bazel-skylib',
},
]);
});
it('extracts dependencies for container_pull deptype', () => {
@ -49,8 +60,16 @@ describe(getName(), () => {
tag="v1.0.0-alpha31.cli-migrations"
)`
);
// FIXME: explicit assert condition
expect(res.deps).toMatchSnapshot();
expect(res.deps).toMatchSnapshot([
{
currentDigest:
'sha256:a4e8d8c444ca04fe706649e82263c9f4c2a4229bc30d2a64561b5e1d20cc8548',
currentValue: 'v1.0.0-alpha31.cli-migrations',
depType: 'container_pull',
lookupName: 'hasura/graphql-engine',
registryUrls: ['index.docker.io'],
},
]);
});
it('check remote option in go_repository', () => {