From 1b395fc95f90c2474617b43a1dcfcbf738d8db0a Mon Sep 17 00:00:00 2001 From: Sergei Zharinov <zharinov@users.noreply.github.com> Date: Fri, 13 Aug 2021 09:15:34 +0300 Subject: [PATCH] refactor: Test snapshots for azure-pipelines and bazel (#11244) --- lib/manager/azure-pipelines/extract.spec.ts | 12 +++++-- lib/manager/bazel/extract.spec.ts | 35 ++++++++++++++++----- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/lib/manager/azure-pipelines/extract.spec.ts b/lib/manager/azure-pipelines/extract.spec.ts index c32324e569..e1ef95b9fe 100644 --- a/lib/manager/azure-pipelines/extract.spec.ts +++ b/lib/manager/azure-pipelines/extract.spec.ts @@ -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(); diff --git a/lib/manager/bazel/extract.spec.ts b/lib/manager/bazel/extract.spec.ts index d5c9b97010..919b954b04 100644 --- a/lib/manager/bazel/extract.spec.ts +++ b/lib/manager/bazel/extract.spec.ts @@ -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', () => { -- GitLab