UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

42 lines 1.75 kB
// SPDX-License-Identifier: Apache-2.0 import { expect } from 'chai'; import Sinon from 'sinon'; import { ClusterCreateRequest } from '../../../../../src/integration/kind/request/cluster/cluster-create-request.js'; import { KindExecutionBuilder } from '../../../../../src/integration/kind/execution/kind-execution-builder.js'; describe('ClusterCreateRequest', () => { let builder; let options; let request; beforeEach(() => { // Create mock objects builder = Sinon.createStubInstance(KindExecutionBuilder); // Restore the chaining behavior for builder methods builder.subcommands.returns(builder); // Create options with a stub for apply method options = { apply: Sinon.stub() }; // Create the request with mocked options request = new ClusterCreateRequest(options); }); afterEach(() => { Sinon.restore(); }); describe('constructor', () => { it('should create an instance with valid options', () => { expect(request).to.be.instanceOf(ClusterCreateRequest); }); it('should throw an error if options are null', () => { expect(() => new ClusterCreateRequest(null)).to.throw('options must not be null'); }); }); describe('apply', () => { it('should add correct subcommands to the builder', () => { request.apply(builder); expect(builder.subcommands).to.have.been.calledOnceWith('create', 'cluster'); }); it('should delegate to options.apply', () => { request.apply(builder); expect(options.apply).to.have.been.calledOnceWith(builder); }); }); }); //# sourceMappingURL=cluster-create-request.test.js.map