Skip to content

Commit

Permalink
start writing the testing tables...
Browse files Browse the repository at this point in the history
  • Loading branch information
EmeraldSnorlax committed Oct 17, 2023
1 parent 52ca51d commit c593def
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
1 change: 1 addition & 0 deletions .vscode/ltex.dictionary.en-GB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ AccountTray
localStorage
WCAG
Leitner
foobar
42 changes: 33 additions & 9 deletions report.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1846,11 +1846,41 @@ \section{Review}
\chapter{Testing}
% TODO Write about fixing the bug where it would send over everyone's decks no matter the user; commits c7ddd2ded26132bfcbfa36db7f60fe1fc0a9b9bb and e81209a338ec11e279d6ea4af6aaf86b74b46706
Because we've been using test-driven development throughout, most of our testing is covered. However, a few things were resolved using manual testing.
\section{Manual}
\subsection{Users getting access to everyone's deck}
\section{Deck fetching}
\subsection{Users getting access to everyone's decks}
\begin{tabular}{|l|p{4cm}|p{4cm}|}
\cline{1-3}
Input & Expected & Actual output \\
\hline \hline
GET /app/decks & [\{name: foobar, public: false, course: null\}] & Every deck in the database from all users. \\
Cookie: *session for user 1* && \\
\hline
\end{tabular}
\paragraph{}
This bug was due to not checking the user ID in the SQL query. As a result, listing the user's decks would return every single deck in the database, including decks that don't belong to the user. This has been resolved, and the test suites have been updated to check for this oversight too.
\subsubsection{Updated Test}
\subsubsection{After bug fix}
\begin{tabular}{|l|p{4cm}|p{4cm}|}
\cline{1-3}
Input & Expected & Actual output \\
\hline \hline
GET /app/decks & [\{name: foobar, public: false, course: null\}] & [\{name: foobar, public: false, course: null\}] \\
Cookie: session=*valid* && \\
\hline \hline
GET /app/decks & 401 Auth needed & 401 Auth needed \\
No cookies && \\
\hline \hline
GET /app/decks & 401 Auth needed & 401 Auth needed \\
Cookie: session=*invalid* && \\
\hline \hline
GET /app/decks & 401 Auth needed & 401 Auth needed \\
Cookie: foo=bar && \\
\hline
\end{tabular}
\begin{minted}[breaklines]{typescript}
beforeEach(async () => {
token = await setupAuth();
Expand Down Expand Up @@ -1902,11 +1932,5 @@ \subsection{Reviewing}
With invalid input, we get the expected error message, and with valid requests, the database is updated correctly.
\begin{figure}[h!]
\includegraphics[width=\linewidth]{./media/testing/Screenshot_20231017_003635.png}
\label{fig:manual1}
\caption{Invalid input is rejected.}
\end{figure}
\printbibliography
\end{document}

0 comments on commit c593def

Please sign in to comment.