Skip to content

Commit

Permalink
omit testcontext until fix for test
Browse files Browse the repository at this point in the history
  • Loading branch information
f4tal-err0r committed Jun 3, 2024
1 parent f0ad2d9 commit 7f6803d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Change these variables as necessary.
MAIN_PACKAGE_PATH := ./cmd/
BINARY_NAME := dfaas

EXCLUDE_TEST := "TestContext"

# ==================================================================================== #
# HELPERS
Expand All @@ -24,9 +24,6 @@ fmt:
lint:
golangci-lint run

## Run all tests except TestContext
test/github:
go test -v -race -buildvcs $(shell go list ./... | grep -v 'runtime/') -run "${GITHUB_TEST_PATTERN}"

## test/cover: run all tests and display coverage
.PHONY: test/cover
Expand Down
50 changes: 25 additions & 25 deletions pkgs/client/context_test.go
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
package client_test

import (
"net/http"
"net/http/httptest"
"testing"
// import (
// "net/http"
// "net/http/httptest"
// "testing"

"github.com/f4tal-err0r/discord_faas/pkgs/client"
"github.com/gorilla/mux"
)
// "github.com/f4tal-err0r/discord_faas/pkgs/client"
// "github.com/gorilla/mux"
// )

// This only works locally with a valid oauth token
func TestContext(t *testing.T) {
// create a rest server
router := mux.NewRouter()
server := httptest.NewServer(router)
// func TestContext(t *testing.T) {
// // create a rest server
// router := mux.NewRouter()
// server := httptest.NewServer(router)

// respond on /api/context
router.HandleFunc("/api/context", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`{"client_id":"123456789012345678","guild_id":"123456789012345678","user_id":"123456789012345678"}`))
})
// // respond on /api/context
// router.HandleFunc("/api/context", func(w http.ResponseWriter, r *http.Request) {
// w.Write([]byte(`{"client_id":"123456789012345678","guild_id":"123456789012345678","user_id":"123456789012345678"}`))
// })

// Create a context
ctx := client.NewContext(server.URL, "123456789012345678")
// // Create a context
// ctx := client.NewContext(server.URL, "123456789012345678")

// Check the context
if ctx.ClientID != "123456789012345678" {
t.Errorf("Unexpected client ID: %s", ctx.ClientID)
}
if ctx.GuildID != "123456789012345678" {
t.Errorf("Unexpected guild ID: %s", ctx.GuildID)
}
}
// // Check the context
// if ctx.ClientID != "123456789012345678" {
// t.Errorf("Unexpected client ID: %s", ctx.ClientID)
// }
// if ctx.GuildID != "123456789012345678" {
// t.Errorf("Unexpected guild ID: %s", ctx.GuildID)
// }
// }

0 comments on commit 7f6803d

Please sign in to comment.