@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
41 lines • 1.57 kB
JavaScript
// SPDX-License-Identifier: Apache-2.0
import { expect } from 'chai';
import Sinon from 'sinon';
import { ClusterDeleteRequest } from '../../../../../../src/integration/kind/request/cluster/cluster-delete-request.js';
describe('ClusterDeleteRequest', () => {
let builder;
let options;
let request;
beforeEach(() => {
// Create a stub for the builder
builder = {
subcommands: Sinon.stub().returnsThis(),
};
// Create mock options with a stub for apply method
options = { apply: Sinon.stub() };
// Create the request with mocked options
request = new ClusterDeleteRequest(options);
});
afterEach(() => {
Sinon.restore();
});
describe('constructor', () => {
it('should create an instance with valid options', () => {
expect(request).to.be.instanceOf(ClusterDeleteRequest);
});
it('should throw an error if options are null', () => {
expect(() => new ClusterDeleteRequest(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('delete', 'cluster');
});
it('should delegate to options.apply', () => {
request.apply(builder);
expect(options.apply).to.have.been.calledOnceWith(builder);
});
});
});
//# sourceMappingURL=cluster-delete-request.test.js.map