@@ -396,6 +396,65 @@ describe("EntityInstanceId.fromString", () => {
396396 } ) ;
397397} ) ;
398398
399+ describe ( "Entity Client Input Validation" , ( ) => {
400+ // Validation guards throw before any gRPC call, so no connection is needed.
401+ const { TaskHubGrpcClient } = require ( "../src" ) ;
402+ let client : InstanceType < typeof TaskHubGrpcClient > ;
403+
404+ beforeEach ( ( ) => {
405+ client = new TaskHubGrpcClient ( { hostAddress : "localhost:4001" } ) ;
406+ } ) ;
407+
408+ describe ( "signalEntity" , ( ) => {
409+ it ( "should throw when id is null" , async ( ) => {
410+ await expect ( client . signalEntity ( null as any , "op" ) ) . rejects . toThrow (
411+ "signalEntity: 'id' is required." ,
412+ ) ;
413+ } ) ;
414+
415+ it ( "should throw when id is undefined" , async ( ) => {
416+ await expect ( client . signalEntity ( undefined as any , "op" ) ) . rejects . toThrow (
417+ "signalEntity: 'id' is required." ,
418+ ) ;
419+ } ) ;
420+
421+ it ( "should throw when operationName is empty string" , async ( ) => {
422+ const entityId = new EntityInstanceId ( "counter" , "my-counter" ) ;
423+ await expect ( client . signalEntity ( entityId , "" ) ) . rejects . toThrow (
424+ "signalEntity: 'operationName' is required and cannot be empty." ,
425+ ) ;
426+ } ) ;
427+
428+ it ( "should throw when operationName is null" , async ( ) => {
429+ const entityId = new EntityInstanceId ( "counter" , "my-counter" ) ;
430+ await expect ( client . signalEntity ( entityId , null as any ) ) . rejects . toThrow (
431+ "signalEntity: 'operationName' is required and cannot be empty." ,
432+ ) ;
433+ } ) ;
434+
435+ it ( "should throw when operationName is undefined" , async ( ) => {
436+ const entityId = new EntityInstanceId ( "counter" , "my-counter" ) ;
437+ await expect ( client . signalEntity ( entityId , undefined as any ) ) . rejects . toThrow (
438+ "signalEntity: 'operationName' is required and cannot be empty." ,
439+ ) ;
440+ } ) ;
441+ } ) ;
442+
443+ describe ( "getEntity" , ( ) => {
444+ it ( "should throw when id is null" , async ( ) => {
445+ await expect ( client . getEntity ( null as any ) ) . rejects . toThrow (
446+ "getEntity: 'id' is required." ,
447+ ) ;
448+ } ) ;
449+
450+ it ( "should throw when id is undefined" , async ( ) => {
451+ await expect ( client . getEntity ( undefined as any ) ) . rejects . toThrow (
452+ "getEntity: 'id' is required." ,
453+ ) ;
454+ } ) ;
455+ } ) ;
456+ } ) ;
457+
399458describe ( "getEntities query normalization" , ( ) => {
400459 const { TaskHubGrpcClient } = require ( "../src" ) ;
401460
0 commit comments