genlayer 0.5.1-beta.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +1 -0
- package/CHANGELOG.md +14 -0
- package/dist/index.js +32697 -5537
- package/docker-compose.yml +4 -4
- package/package.json +2 -1
- package/src/commands/general/index.ts +4 -4
- package/src/commands/general/init.ts +7 -0
- package/src/commands/keygen/create.ts +44 -0
- package/src/commands/keygen/index.ts +21 -0
- package/src/index.ts +3 -1
- package/src/lib/config/ConfigFileManager.ts +51 -0
- package/src/lib/interfaces/ISimulatorService.ts +1 -0
- package/src/lib/services/simulator.ts +17 -0
- package/tests/actions/create.test.ts +140 -0
- package/tests/actions/init.test.ts +3 -2
- package/tests/commands/init.test.ts +9 -1
- package/tests/commands/keygen.test.ts +77 -0
- package/tests/index.test.ts +4 -0
- package/tests/libs/configFileManager.test.ts +113 -0
- package/tests/services/simulator.test.ts +34 -0
|
@@ -505,3 +505,37 @@ describe("SimulatorService - Docker Tests", () => {
|
|
|
505
505
|
consoleWarnSpy.mockRestore();
|
|
506
506
|
});
|
|
507
507
|
});
|
|
508
|
+
|
|
509
|
+
describe('normalizeLocalnetVersion', () => {
|
|
510
|
+
test('should add "v" if not present', () => {
|
|
511
|
+
expect(simulatorService.normalizeLocalnetVersion("0.26.0")).toBe("v0.26.0");
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
test('should preserve "v" if already present', () => {
|
|
515
|
+
expect(simulatorService.normalizeLocalnetVersion("v0.26.0")).toBe("v0.26.0");
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
test('should retain suffixes like "-test000"', () => {
|
|
519
|
+
expect(simulatorService.normalizeLocalnetVersion("0.25.0-test000")).toBe("v0.25.0-test000");
|
|
520
|
+
expect(simulatorService.normalizeLocalnetVersion("v1.0.0-alpha")).toBe("v1.0.0-alpha");
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
test('should handle versions with numbers only', () => {
|
|
524
|
+
expect(simulatorService.normalizeLocalnetVersion("1.0.0")).toBe("v1.0.0");
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
test('should throw an error and exit for invalid versions', () => {
|
|
528
|
+
const mockExit = vi.spyOn(process, 'exit').mockImplementation(() => { return undefined as never});
|
|
529
|
+
const mockConsoleError = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
530
|
+
|
|
531
|
+
simulatorService.normalizeLocalnetVersion("invalid-version");
|
|
532
|
+
|
|
533
|
+
expect(mockConsoleError).toHaveBeenCalledWith(
|
|
534
|
+
'Invalid version format. Expected format: v0.0.0 or v0.0.0-suffix'
|
|
535
|
+
);
|
|
536
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
537
|
+
|
|
538
|
+
mockExit.mockRestore();
|
|
539
|
+
mockConsoleError.mockRestore();
|
|
540
|
+
});
|
|
541
|
+
});
|