input: Write a function to construct a neural network model using Keras in Python that correctly classifies the MNIST dataset. The model should include an input layer with the shape (784,), a hidden layer with 128 units and 'relu' activation, and an output layer with 10 units and 'softmax' activation. The model should be compiled using the 'adam' optimizer and 'sparse_categorical_crossentropy' loss.
  
  def construct_mnist_model():
      import keras
  
      # Input layer
      input_layer = keras.layers.Input(shape=(784,))
  
      # Hidden layer
      hidden_layer = keras.layers.Dense(128, 
                      activation='relu')(input_layer)
  
      # Output layer
      output_layer = keras.layers.Dense(10, 
                      activation='softmax')(hidden_layer)
  
      # Model
      model = keras.Model(inputs=input_layer, outputs=output_layer)
  
      # Compile model
      model.compile(optimizer='adam', 
                    loss='sparse_categorical_crossentropy',
                    metrics=['accuracy'])
  
      return model
  
  # Test case
  assert isinstance(construct_mnist_model(), keras.Model)
  assert len(construct_mnist_model().layers) == 3
  assert construct_mnist_model().layers[1].units == 128
  assert construct_mnist_model().layers[1].activation.__name__ == 'relu'
  assert construct_mnist_model().layers[2].units == 10
  assert construct_mnist_model().layers[2].activation.__name__ == 'softmax'
  assert construct_mnist_model().optimizer.get_config()['name'] == 'Adam'
  assert construct_mnist_model().loss == 'sparse_categorical_crossentropy'
  
  # Expected output for the test case:
  # All assertions should pass, indicating that the model is correctly constructed.
output: def construct_mnist_model():
      import keras
  
      input_layer = keras.layers.Input(shape=(784,))
      hidden_layer = keras.layers.Dense(128, activation='relu')(input_layer)
      output_layer = keras.layers.Dense(10, activation='softmax')(hidden_layer)
      model = keras.Model(inputs=input_layer, outputs=output_layer)
      model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
      return model