Skip to content

Commit

Permalink
test(datasource/gitlab-packages): added conan packages test
Browse files Browse the repository at this point in the history
  • Loading branch information
FFace32 committed Dec 14, 2024
1 parent 0b07969 commit 22e1327
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion lib/modules/datasource/gitlab-packages/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('modules/datasource/gitlab-packages/index', () => {
it('returns package from custom registry', async () => {
const body = [
{
version: '1.0.0',
version: 'v1.0.0',
created_at: '2020-03-04T12:01:37.000-06:00',
name: 'mypkg',
},
Expand Down Expand Up @@ -45,6 +45,50 @@ describe('modules/datasource/gitlab-packages/index', () => {
expect(res?.releases).toHaveLength(3);
});

it('returns conan package from custom registry', async () => {
const body = [
{
version: 'v1.0.0',
created_at: '2020-03-04T12:01:37.000-06:00',
name: 'myconanpkg/1.0.0@mycompany/stable',
conan_package_name: 'myconanpkg',
},
{
version: 'v1.1.0',
created_at: '2020-04-04T12:01:37.000-06:00',
name: 'myconanpkg/1.1.0@mycompany/stable',
conan_package_name: 'myconanpkg',
},
{
version: 'v1.1.1',
created_at: '2020-05-04T12:01:37.000-06:00',
name: 'myconanpkg/1.1.0@mycompany/stable',
conan_package_name: 'myconanpkg',
},
{
version: 'v2.0.0',
created_at: '2020-05-04T12:01:37.000-06:00',
name: 'otherpkg/2.0.0@mycompany/stable',
conan_package_name: 'otherpkg',
},
];
httpMock
.scope('https://gitlab.com')
.get('/api/v4/projects/user%2Fproject1/packages')
.query({
package_name: 'myconanpkg',
per_page: '100',
})
.reply(200, body);
const res = await getPkgReleases({
datasource,
registryUrls: ['https://gitlab.com'],
packageName: 'user/project1:myconanpkg',
});
expect(res).toMatchSnapshot();

Check failure on line 88 in lib/modules/datasource/gitlab-packages/index.spec.ts

View workflow job for this annotation

GitHub Actions / test (1/16)

modules/datasource/gitlab-packages/index › getReleases › returns conan package from custom registry

expect(received).toMatchSnapshot() Snapshot name: `modules/datasource/gitlab-packages/index getReleases returns conan package from custom registry 1` New snapshot was not written. The update flag must be explicitly passed to write a new snapshot. This is likely because this test is run in a continuous integration (CI) environment in which snapshots are not written by default. Received: { "registryUrl": "https://gitlab.com", "releases": [ { "releaseTimestamp": "2020-03-04T18:01:37.000Z", "version": "v1.0.0", }, { "releaseTimestamp": "2020-04-04T18:01:37.000Z", "version": "v1.1.0", }, { "releaseTimestamp": "2020-05-04T18:01:37.000Z", "version": "v1.1.1", }, ], } at Object.<anonymous> (lib/modules/datasource/gitlab-packages/index.spec.ts:88:19)
expect(res?.releases).toHaveLength(3);
});

it('returns null for 404', async () => {
httpMock
.scope('https://gitlab.com')
Expand Down

0 comments on commit 22e1327

Please sign in to comment.