Skip to content

Commit 82f534b

Browse files
Merge pull request #352 from supertokens/fix-react-tests
fix: Update CICD config and auth react test server
2 parents c192328 + e1c1c1e commit 82f534b

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

.circleci/config_continue.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,16 @@ jobs:
5151
- checkout
5252
- run: apt-get install lsof
5353
- run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/
54-
- run: curl -fsSL https://deb.nodesource.com/setup_16.x | bash
55-
- run: apt install -y nodejs
56-
- run: node --version
54+
- run: curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
55+
- run: |
56+
set +e
57+
export NVM_DIR="$HOME/.nvm"
58+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
59+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
60+
nvm install 16
61+
62+
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
63+
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
5764
- run: echo "127.0.0.1 localhost.org" >> /etc/hosts
5865
- run: go version
5966
- run: rm -rf /etc/alternatives/java

test/auth-react-server/main.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,43 @@ func callSTInit(passwordlessConfig *plessmodels.TypeInput) {
675675
rw.WriteHeader(200)
676676
rw.Write([]byte("{\"status\": \"OK\"}"))
677677
}).ServeHTTP(rw, r)
678+
} else if r.URL.Path == "/deleteUser" {
679+
bodyBytes, err := ioutil.ReadAll(r.Body)
680+
if err != nil {
681+
rw.WriteHeader(500)
682+
rw.Write([]byte("Internal error"))
683+
return
684+
}
685+
var body map[string]interface{}
686+
err = json.Unmarshal(bodyBytes, &body)
687+
if err != nil {
688+
rw.WriteHeader(500)
689+
rw.Write([]byte("Internal error"))
690+
return
691+
}
692+
693+
if body["rid"] != "emailpassword" {
694+
rw.WriteHeader(400)
695+
rw.Write([]byte("{\"message\": \"Not Implemented\"}"))
696+
return
697+
}
698+
699+
user, err := emailpassword.GetUserByEmail(body["email"].(string))
700+
if err != nil {
701+
rw.WriteHeader(500)
702+
rw.Write([]byte("Internal error"))
703+
return
704+
}
705+
706+
err = supertokens.DeleteUser(user.ID)
707+
if err != nil {
708+
rw.WriteHeader(500)
709+
rw.Write([]byte("Internal error"))
710+
return
711+
}
712+
713+
rw.WriteHeader(200)
714+
rw.Write([]byte("{\"status\": \"OK\"}"))
678715
}
679716
}))
680717

0 commit comments

Comments
 (0)