From a73ea8c9c7bf5d57ed57e23cfb1af5b5322f9072 Mon Sep 17 00:00:00 2001 From: garrettladley Date: Sat, 27 Jan 2024 15:17:34 -0500 Subject: [PATCH] done --- CONTRIBUTING.md | 38 +++++++++++++++++++------------------- README.md | 8 ++++++++ backend/tests/README.md | 28 +--------------------------- 3 files changed, 28 insertions(+), 46 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 510bfc357..594be0b25 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,20 +22,20 @@ 1. **Clone the repository** - ```bash + ```console git clone git@github.com:GenerateNU/sac.git ``` 2. **Install dependencies** - ```bash + ```console cd frontend/* yarn install ``` - If you get an error about `expo-cli` not being installed, run `yarn global add expo-cli` and then run `yarn install` again. - ```bash + ```console cd server go get ./... ``` @@ -46,7 +46,7 @@ 1. **Create client build** - ```bash + ```console cd frotend/sac-mobile eas login eas build:configure @@ -61,7 +61,7 @@ 3. **Start the client** - ```bash + ```console cd frontend/sac-mobile npx expo start --dev-client ``` @@ -74,40 +74,40 @@ - MacOS - ```bash + ```console brew services start postgresql@15 ``` - Windows - ```bash + ```console pg_ctl -D /usr/local/var/postgres start ``` 2. **Create a user** - ```bash + ```console createdb ``` 3. **Create a database** - ```bash + ```console psql // opens psql shell CREATE DATABASE sac; ``` 4. **Create a user** - ```bash + ```console createuser postgres -U ``` # Commands -### React Native +## React Native - ```bash + ```console npx expo start --dev-client // runnning dev client npx expo start --dev-client --ios // specific platform yarn format // format code @@ -115,9 +115,9 @@ yarn test // run tests ``` -### Go +## Go - ```bash + ```console go run main.go // run server go test ./... // run tests go fmt ./... // format code @@ -128,7 +128,7 @@ To install use `./install.sh` and then run `sac-cli` to see all commands. - ```bash + ```console sac-cli migrate // run migrations sac-cli reset // reset database sac-cli swagger // generate swagger docs @@ -141,7 +141,7 @@ 1. **Create a new branch** - ```bash + ```console git checkout -b // this is determined by your ticket name ``` @@ -149,7 +149,7 @@ - **Commit changes** - ```bash + ```console git add . git commit ``` @@ -160,13 +160,13 @@ 3. **Push changes to GitHub** - ```bash + ```console git push ``` or - ```bash + ```console git push origin ``` diff --git a/README.md b/README.md index 03c587783..f9fdebd02 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,11 @@ alt="Go Workflow Status" /> + +## Contributors + +
+ + + +
diff --git a/backend/tests/README.md b/backend/tests/README.md index 29fc4ad2e..fe7b41759 100644 --- a/backend/tests/README.md +++ b/backend/tests/README.md @@ -25,7 +25,7 @@ TestRequest{ Path: "/api/v1/tags/", Body: &map[string]interface{}{ "name": tagName, - "category_id": 1, + "category_id": uuid.New(), }, } ``` @@ -93,32 +93,6 @@ func AssertCategoryWithIDBodyRespDB(app TestApp, assert *assert.A, resp *http.Re Since the test suite creates a new database for each test, we can have a deterministic database state for each test. However, what if we have a multi step test that depends on the previous steps database state? That is where `ExistingAppAssert` comes in! This will allow us to keep using the database from a previous step in the test. -Consider this example, to create a tag, we need to create a category first. This is a multi step test, so we need to use `ExistingAppAssert` to keep the database state from the previous step. - -```go -TestRequest{ - Method: fiber.MethodPost, - Path: "/api/v1/categories/", - Body: SampleCategoryFactory(), - }.TestOnStatusAndDB(t, nil, - DBTesterWithStatus{ - Status: fiber.StatusCreated, - DBTester: AssertSampleCategoryBodyRespDB, - }, - ) - -TestRequest{ - Method: fiber.MethodPost, - Path: "/api/v1/tags/", - Body: SampleTagFactory(), - }.TestOnStatusAndDB(t, &appAssert, - DBTesterWithStatus{ - Status: fiber.StatusCreated, - DBTester: AssertSampleTagBodyRespDB, - }, - ).Close() -``` - ### Why Close? This closes the connection to the database. This is important because if you don't close the connection, we will run out of available connections and the tests will fail. **Call this on the last test request of a test**