Skip to content

Instantly share code, notes, and snippets.

View ivancorrales's full-sized avatar
🐾
Doing what I love to do!

Iván Corrales Solera ivancorrales

🐾
Doing what I love to do!
View GitHub Profile
scenario "happy path" {
given "my user details" {
set user {
value = {
fullName = "John Smith"
username = "[email protected]"
password = "secret"
}
}
}
description = <<EOF
This feature verify that API works as expected
EOF
includes = [
"includes/database.hcl",
"includes/api.hcl",
"happyPath.hcl",
"signUp-failures.hcl",
"signIn-failures.hcl",
func dropCollection {
input {
arg mongoUri {
description = "mongo uri"
}
arg database {
description = "Name of the database"
default = "admin"
vars {
mediaJson = "application/json"
}
func signUp {
input {
arg baseApi {
description = "URL base of the API"
}
arg user {
# scenario-mult.hcl
scenario "operation multiplication" {
examples = [
{ x = 20, y = 10, multResult= 200},
{ x = -1, y = -2, multResult= 2},
{ x = 5, y = 5, multResult= 25},
{ x = 5, y = 0, multResult= 0},
]
given "initialie result" {
set result {
# scenario-sub.hcl
scenario "operation substract" {
examples = [
{ x = 20, y = 10, subResult= 10},
{ x = 10, y = 20, subResult= 10},
{ x = 5, y = 5, subResult= 0},
]
when "subtract y to x" {
set result {
value = x - y
# scenario-sum.hcl
scenario "operation add" {
when "values are added" {
set result {
value = x + y
}
}
then "the result of the operation is the expected" {
assert {
assertion = result==sumResult
# variables-math-operations.hcl
x = 46
y = 54
sumResult = 100
subResult = 8
# feature-math-operations.hcl
description = <<EOF
This feature is used to demonstrate that both add and subs
operations work as expected.
EOF
input {
arg x {
default = 10
}
arg y {
package advice
import (
"bytes"
"crypto/md5"
"encoding/gob"
"encoding/hex"
"fmt"
"github.com/patrickmn/go-cache"
"github.com/wesovilabs/beyond/api"