Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AryaanSheth committed Sep 6, 2024
1 parent 29b2070 commit 5a24e92
Showing 1 changed file with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions test/gloq_test.gleam
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 5a24e92

Please sign in to comment.