Skip to content

Instantly share code, notes, and snippets.

View BK1031's full-sized avatar

Bharat Kathi BK1031

View GitHub Profile
@BK1031
BK1031 / main_test.go
Last active July 16, 2024 17:27
singlestore-go-bookstore api test setup
package api
import (
"bookstore/config"
"bookstore/database"
"context"
"log"
"os"
"testing"
@BK1031
BK1031 / book_test.go
Created July 16, 2024 18:02
singlestore-go-bookstore testcreatebook api
func TestCreateBook(t *testing.T) {
// Arrange
book := model.Book{
Title: "The Great Gatsby",
Author: "F. Scott Fitzgerald",
Price: 29.99,
Genre: "Fiction",
}
reqBody, _ := json.Marshal(book)
t.Run("Success", func(t *testing.T) {