Skip to main content

hget_watch_test.go

hget_watch_test.go - Overview

This file contains tests for the HGET.WATCH command within the ironhawk package. These tests primarily focus on validating the command's argument handling.

Detailed Documentation

Function: TestHGETWATCH

Purpose: Tests the HGET.WATCH command for correct argument handling, specifically checking for errors when the required key or field arguments are missing.

Parameters:

  • t (*testing.T): Testing framework instance.

Returns: None

Test Cases:

The testCases variable is a slice of TestCase structs (not defined in the provided code). Each test case defines a scenario to test the HGET.WATCH command. The tests check for specific error messages when the command is called with an incorrect number of arguments.

The test cases include:

  • "HGet watch subscription without key arg": Tests the scenario where the HGET.WATCH command is called without the key argument. It expects an error message indicating the wrong number of arguments.
  • "HGet watch subscription without field arg": Tests the scenario where the HGET.WATCH command is called without the field argument. It expects an error message indicating the wrong number of arguments.

Helper Functions:

  • getLocalConnection(): (Not defined in the code) Presumably returns a local client connection for testing.
  • client.Close(): Closes the client connection.
  • runTestcases(t *testing.T, client interface{}, testCases []TestCase): (Not defined in the code) Executes the test cases against the provided client.

Getting Started Relevance: NO