fix(ci): Update CI workflows, build scripts, and export configuration
This commit is contained in:
75
test/test.source-ora.node.ts
Normal file
75
test/test.source-ora.node.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
import { SmartlogSourceOra } from '../ts_source_ora/index.js';
|
||||
|
||||
let testSourceOra: SmartlogSourceOra;
|
||||
|
||||
tap.test('should create a SmartlogSourceOra instance', async () => {
|
||||
testSourceOra = new SmartlogSourceOra();
|
||||
expect(testSourceOra).toBeTruthy();
|
||||
expect(testSourceOra.started).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('should set text and start spinner', async () => {
|
||||
const testText = 'Testing ora spinner';
|
||||
testSourceOra.text(testText);
|
||||
|
||||
expect(testSourceOra.started).toBeTrue();
|
||||
expect(testSourceOra.oraInstance.text).toEqual(testText);
|
||||
});
|
||||
|
||||
tap.test('should update text', async () => {
|
||||
const newText = 'Updated text';
|
||||
testSourceOra.text(newText);
|
||||
|
||||
expect(testSourceOra.oraInstance.text).toEqual(newText);
|
||||
expect(testSourceOra.started).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('should stop spinner', async () => {
|
||||
testSourceOra.stop();
|
||||
// We can't easily test the visual state, but we can verify it doesn't throw errors
|
||||
});
|
||||
|
||||
tap.test('should finish with success', async () => {
|
||||
testSourceOra = new SmartlogSourceOra();
|
||||
testSourceOra.text('Starting again');
|
||||
|
||||
const successText = 'Operation successful';
|
||||
testSourceOra.finishSuccess(successText);
|
||||
|
||||
expect(testSourceOra.started).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('should finish with failure', async () => {
|
||||
testSourceOra = new SmartlogSourceOra();
|
||||
testSourceOra.text('Starting again');
|
||||
|
||||
const failText = 'Operation failed';
|
||||
testSourceOra.finishFail(failText);
|
||||
|
||||
expect(testSourceOra.started).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('should handle success and next', async () => {
|
||||
testSourceOra = new SmartlogSourceOra();
|
||||
testSourceOra.text('Starting again');
|
||||
|
||||
const nextText = 'Next operation';
|
||||
testSourceOra.successAndNext(nextText);
|
||||
|
||||
expect(testSourceOra.started).toBeTrue();
|
||||
expect(testSourceOra.oraInstance.text).toEqual(nextText);
|
||||
});
|
||||
|
||||
tap.test('should handle fail and next', async () => {
|
||||
testSourceOra = new SmartlogSourceOra();
|
||||
testSourceOra.text('Starting again');
|
||||
|
||||
const nextText = 'Next operation after failure';
|
||||
testSourceOra.failAndNext(nextText);
|
||||
|
||||
expect(testSourceOra.started).toBeTrue();
|
||||
expect(testSourceOra.oraInstance.text).toEqual(nextText);
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user