Skip to content

Commit

Permalink
Adding bunch of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemanja Tesic committed Oct 15, 2024
1 parent 9d6d50b commit 96c30e3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/__tests__/monorepo/getPackageGraph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,18 @@ describe('getPackageGraph', () => {
bar: { dependencies: { foo: '1.0.0' } },
});

expect(async () => {
await expect(async () => {
await getPackageGraphPackageNames(['foo', 'bar'], packageInfos);
}).rejects.toThrow(/We could not find a node in the graph with no dependencies, this likely means there is a cycle including all nodes/);
});

it('throws if contains circular dependencies', () => {
it('throws if contains circular dependencies', async () => {
const packageInfos = makePackageInfos({
foo: { dependencies: { bar: '1.0.0', bar2: '1.0.0' } },
bar: { dependencies: { foo: '1.0.0' } },
});

expect(async () => {
await expect(async () => {
await getPackageGraphPackageNames(['foo', 'bar', 'bar2'], packageInfos);
}).rejects.toThrow(/A cycle has been detected including the following nodes:\nfoo\nbar/);
});
Expand All @@ -144,10 +144,10 @@ describe('getPackageGraph', () => {
await getPackageGraphPackageNames(['foo', 'bar'], packageInfos)
});

it('throws if package info is missing', () => {
it('throws if package info is missing', async () => {
const packageInfos = {} as any as PackageInfos;

expect(async () => {
await expect(async () => {
await getPackageGraphPackageNames(['foo', 'bar'], packageInfos)
}).rejects.toThrow(`Cannot read properties of undefined (reading 'name')`);
});
Expand Down

0 comments on commit 96c30e3

Please sign in to comment.