From 5a24e929aec3f909a77662b1ffa1759fd32a6153 Mon Sep 17 00:00:00 2001 From: AryaanSheth Date: Fri, 6 Sep 2024 11:42:52 -0400 Subject: [PATCH] Added tests --- test/gloq_test.gleam | 53 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/test/gloq_test.gleam b/test/gloq_test.gleam index 3831e7a..ea1670d 100644 --- a/test/gloq_test.gleam +++ b/test/gloq_test.gleam @@ -1,12 +1,57 @@ import gleeunit import gleeunit/should +import gloq pub fn main() { gleeunit.main() } -// gleeunit test functions end in `_test` -pub fn hello_world_test() { - 1 - |> should.equal(1) +pub fn default_groq_request_test() { + let builder = gloq.default_groq_request() + builder.key |> should.equal("") + builder.user |> should.equal("user") + builder.context |> should.equal("") + builder.model |> should.equal("llama3-8b-8192") +} + +pub fn new_groq_request_test() { + let builder = gloq.new_groq_request() + builder.key |> should.equal("") + builder.user |> should.equal("") + builder.context |> should.equal("") + builder.model |> should.equal("") +} + +pub fn with_key_test() { + let builder = gloq.new_groq_request() |> gloq.with_key("test_key") + builder.key |> should.equal("test_key") +} + +pub fn with_user_test() { + let builder = gloq.new_groq_request() |> gloq.with_user("test_user") + builder.user |> should.equal("test_user") +} + +pub fn with_context_test() { + let builder = gloq.new_groq_request() |> gloq.with_context("test_context") + builder.context |> should.equal("test_context") +} + +pub fn with_model_test() { + let builder = gloq.new_groq_request() |> gloq.with_model("test_model") + builder.model |> should.equal("test_model") +} + +pub fn chained_builder_test() { + let builder = + gloq.new_groq_request() + |> gloq.with_key("test_key") + |> gloq.with_user("test_user") + |> gloq.with_context("test_context") + |> gloq.with_model("test_model") + + builder.key |> should.equal("test_key") + builder.user |> should.equal("test_user") + builder.context |> should.equal("test_context") + builder.model |> should.equal("test_model") }