27 lines
499 B
Gleam
27 lines
499 B
Gleam
import gleam/list
|
|
import gleam/string
|
|
import gleeunit
|
|
import gleeunit/should
|
|
import key
|
|
|
|
pub fn main() {
|
|
gleeunit.main()
|
|
}
|
|
|
|
pub fn generate_test() {
|
|
let key_result = key.generate()
|
|
let allowed_chars =
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
|
|
|
key_result |> should.not_equal("")
|
|
|
|
key_result
|
|
|> string.length
|
|
|> should.equal(16)
|
|
|
|
key_result
|
|
|> string.to_graphemes
|
|
|> list.all(fn(char) { allowed_chars |> string.contains(char) })
|
|
|> should.be_true
|
|
}
|