Skip to content

Commit

Permalink
replace toBe with toMatchObject
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Dec 20, 2023
1 parent 3db93b2 commit 90bd0b0
Showing 1 changed file with 36 additions and 50 deletions.
86 changes: 36 additions & 50 deletions lib/modules/manager/poetry/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,16 @@ describe('modules/manager/poetry/extract', () => {
werkzeug = ">=0.14"
`;
const res = (await extractPackageFile(content, filename))!.deps;
expect(res[0].depName).toBe('fastapi');
expect(res[0].packageName).toBe(
'https://github.com/tiangolo/fastapi.git',
);
expect(res[0].currentValue).toBeUndefined();
expect(res[0].currentDigest).toBe(
'6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
);
expect(res[0].replaceString).toBe(
'6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
);
expect(res[0].pinDigests).toBe(true);
expect(res[0].skipReason).toBeUndefined();
expect(res[0].datasource).toBe(GitRefsDatasource.id);
expect(res).toHaveLength(2);
expect(res[0]).toMatchObject({
depName: 'fastapi',
datasource: GitRefsDatasource.id,
currentValue: undefined,
currentDigest: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
replaceString: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
pinDigests: true,
packageName: 'https://github.com/tiangolo/fastapi.git',
});
});

it('parses git dependencies short commit hashs on http urls', async () => {
Expand All @@ -201,17 +196,16 @@ describe('modules/manager/poetry/extract', () => {
werkzeug = ">=0.14"
`;
const res = (await extractPackageFile(content, filename))!.deps;
expect(res[0].depName).toBe('fastapi');
expect(res[0].packageName).toBe(
'https://github.com/tiangolo/fastapi.git',
);
expect(res[0].currentValue).toBeUndefined();
expect(res[0].currentDigest).toBe('6f5aa81');
expect(res[0].replaceString).toBe('6f5aa81');
expect(res[0].pinDigests).toBe(true);
expect(res[0].skipReason).toBeUndefined();
expect(res[0].datasource).toBe(GitRefsDatasource.id);
expect(res).toHaveLength(2);
expect(res[0]).toMatchObject({
depName: 'fastapi',
datasource: GitRefsDatasource.id,
currentValue: undefined,
currentDigest: '6f5aa81',
replaceString: '6f5aa81',
pinDigests: true,
packageName: 'https://github.com/tiangolo/fastapi.git',
});
});

it('parses git dependencies long commit hashs on ssh urls', async () => {
Expand All @@ -221,19 +215,16 @@ describe('modules/manager/poetry/extract', () => {
werkzeug = ">=0.14"
`;
const res = (await extractPackageFile(content, filename))!.deps;
expect(res[0].depName).toBe('fastapi');
expect(res[0].packageName).toBe('[email protected]:tiangolo/fastapi.git');
expect(res[0].currentValue).toBeUndefined();
expect(res[0].currentDigest).toBe(
'6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
);
expect(res[0].replaceString).toBe(
'6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
);
expect(res[0].pinDigests).toBe(true);
expect(res[0].skipReason).toBeUndefined();
expect(res[0].datasource).toBe(GitRefsDatasource.id);
expect(res).toHaveLength(2);
expect(res[0]).toMatchObject({
depName: 'fastapi',
datasource: GitRefsDatasource.id,
currentValue: undefined,
currentDigest: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
replaceString: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
pinDigests: true,
packageName: '[email protected]:tiangolo/fastapi.git',
});
});

it('parses git dependencies long commit hashs on http urls with branch marker', async () => {
Expand All @@ -243,21 +234,16 @@ describe('modules/manager/poetry/extract', () => {
werkzeug = ">=0.14"
`;
const res = (await extractPackageFile(content, filename))!.deps;
expect(res[0].depName).toBe('fastapi');
expect(res[0].packageName).toBe(
'https://github.com/tiangolo/fastapi.git',
);
expect(res[0].currentValue).toBe('develop');
expect(res[0].currentDigest).toBe(
'6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
);
expect(res[0].replaceString).toBe(
'6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
);
expect(res[0].pinDigests).toBe(true);
expect(res[0].skipReason).toBeUndefined();
expect(res[0].datasource).toBe(GitRefsDatasource.id);
expect(res).toHaveLength(2);
expect(res[0]).toMatchObject({
depName: 'fastapi',
datasource: GitRefsDatasource.id,
currentValue: 'develop',
currentDigest: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
replaceString: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc',
pinDigests: true,
packageName: 'https://github.com/tiangolo/fastapi.git',
});
});

it('parses github dependencies tags on ssh urls', async () => {
Expand Down

0 comments on commit 90bd0b0

Please sign in to comment.