Skip to content

Commit

Permalink
assert warn being called
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaiwat10 committed Jan 2, 2025
1 parent 73a8523 commit 953b526
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/create-fuels/src/lib/getPackageManager.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { mockLogger } from '../../test/utils/mockLogger';

import type { PackageManager } from './getPackageManager';
import { availablePackageManagers, getPackageManager, packageMangers } from './getPackageManager';

Expand All @@ -14,6 +16,14 @@ const runScenarios: [PackageManager, string][] = [
['bun', 'bun run fuels:dev'],
];

const mockAllDeps = () => {
const { warn } = mockLogger();

return {
warn,
};
};

/**
* @group node
*/
Expand Down Expand Up @@ -64,9 +74,11 @@ describe('getPackageManager', () => {
it('should default to npm', () => {
const packageManager = 'npm';
const expectedPackageManager = packageMangers[packageManager];
const { warn } = mockAllDeps();

const result = getPackageManager();

expect(result).toEqual(expectedPackageManager);
expect(warn).toHaveBeenCalledWith(`This package manager is not supported. Using npm instead.`);
});
});

0 comments on commit 953b526

Please sign in to comment.