|
11 | 11 | */ |
12 | 12 |
|
13 | 13 | import { |
| 14 | + getCliSpinners, |
14 | 15 | Spinner, |
15 | 16 | withSpinner, |
16 | 17 | withSpinnerSync, |
@@ -679,4 +680,40 @@ describe('spinner', () => { |
679 | 680 | expect(result).toBe(spinner) |
680 | 681 | }) |
681 | 682 | }) |
| 683 | + |
| 684 | + describe('getCliSpinners', () => { |
| 685 | + it('should return socket custom spinner', () => { |
| 686 | + const socket = getCliSpinners('socket') |
| 687 | + expect(socket).toBeDefined() |
| 688 | + expect(socket.frames).toBeDefined() |
| 689 | + expect(socket.interval).toBeDefined() |
| 690 | + }) |
| 691 | + |
| 692 | + it('should return undefined for non-existent spinner', () => { |
| 693 | + const result = getCliSpinners('non-existent-spinner') |
| 694 | + expect(result).toBeUndefined() |
| 695 | + }) |
| 696 | + |
| 697 | + it('should cache spinner styles', () => { |
| 698 | + const first = getCliSpinners() |
| 699 | + const second = getCliSpinners() |
| 700 | + expect(first).toBe(second) |
| 701 | + }) |
| 702 | + }) |
| 703 | + |
| 704 | + describe('Stream handling', () => { |
| 705 | + it('should accept custom stream', () => { |
| 706 | + const customStream = process.stderr |
| 707 | + const spinner = Spinner({ stream: customStream }) |
| 708 | + expect(spinner).toBeDefined() |
| 709 | + }) |
| 710 | + |
| 711 | + it('should work with stderr', () => { |
| 712 | + const spinner = Spinner({ stream: process.stderr }) |
| 713 | + spinner.start() |
| 714 | + spinner.text('test') |
| 715 | + spinner.stop() |
| 716 | + expect(spinner.isSpinning).toBe(false) |
| 717 | + }) |
| 718 | + }) |
682 | 719 | }) |
0 commit comments