node-sagas
Version:
Library for handling distributed transactions in the microservices architecture
30 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const saga_builder_1 = require("../saga-builder");
const saga_1 = require("../saga");
describe('SagaBuilder', () => {
let sagaBuilder;
beforeEach(() => {
sagaBuilder = new saga_builder_1.SagaBuilder();
});
it('should build saga', () => {
const saga = sagaBuilder.build();
expect(saga).toBeInstanceOf(saga_1.Saga);
});
it('should return builder instance on step', () => {
const builder = sagaBuilder.step();
expect(builder).toBeInstanceOf(saga_builder_1.SagaBuilder);
});
it('should return builder instance on invoke', () => {
const builder = sagaBuilder.step().invoke(() => 'Invocation logic');
expect(builder).toBeInstanceOf(saga_builder_1.SagaBuilder);
});
it('should return builder instance with compensation', () => {
const builder = sagaBuilder
.step()
.invoke(() => 'Invocation logic')
.withCompensation(() => 'Compensation logic');
expect(builder).toBeInstanceOf(saga_builder_1.SagaBuilder);
});
});
//# sourceMappingURL=saga-builder.spec.js.map