|
1 | | - |
2 | 1 | import { describe, it, expect, vi, beforeEach } from 'vitest'; |
3 | 2 | import { existsSync, readFileSync, writeFileSync } from 'fs'; |
4 | 3 | import { PythonUpdater } from '../../src/updaters/pythonUpdater'; |
@@ -58,23 +57,27 @@ describe('PythonUpdater', () => { |
58 | 57 | }); |
59 | 58 |
|
60 | 59 | it('should return null if no manifest file is found', () => { |
61 | | - (existsSync as vi.Mock).mockReturnValue(false); |
62 | | - pythonUpdater.canHandle(); |
63 | | - expect(pythonUpdater.getCurrentVersion()).toBeNull(); |
64 | | - }); |
| 60 | + (existsSync as vi.Mock).mockReturnValue(false); |
| 61 | + pythonUpdater.canHandle(); |
| 62 | + expect(pythonUpdater.getCurrentVersion()).toBeNull(); |
| 63 | + }); |
65 | 64 |
|
66 | 65 | it('should throw an error if pyproject.toml exists but version is not found', () => { |
67 | 66 | (existsSync as vi.Mock).mockImplementation((path) => path === 'pyproject.toml'); |
68 | 67 | (readFileSync as vi.Mock).mockReturnValue('name = "my-package"'); // Missing version |
69 | 68 | pythonUpdater.canHandle(); |
70 | | - expect(() => pythonUpdater.getCurrentVersion()).toThrow("Regex 'version\\s*=\\s*\"([^\"]+)\"' did not find a match in pyproject.toml"); |
| 69 | + expect(() => pythonUpdater.getCurrentVersion()).toThrow( |
| 70 | + 'Regex \'version\\s*=\\s*"([^"]+)"\' did not find a match in pyproject.toml', |
| 71 | + ); |
71 | 72 | }); |
72 | 73 |
|
73 | 74 | it('should throw an error if setup.py exists but version is not found', () => { |
74 | 75 | (existsSync as vi.Mock).mockImplementation((path) => path === 'setup.py'); |
75 | 76 | (readFileSync as vi.Mock).mockReturnValue('setup(name="my-package")'); // Missing version |
76 | 77 | pythonUpdater.canHandle(); |
77 | | - expect(() => pythonUpdater.getCurrentVersion()).toThrow("Regex 'version\\s*=\\s*[\"']([^\"']+)[\"']' did not find a match in setup.py"); |
| 78 | + expect(() => pythonUpdater.getCurrentVersion()).toThrow( |
| 79 | + "Regex 'version\\s*=\\s*[\"']([^\"']+)[\"']' did not find a match in setup.py", |
| 80 | + ); |
78 | 81 | }); |
79 | 82 | }); |
80 | 83 |
|
|
0 commit comments