@@ -21,7 +21,9 @@ const Constants = {
2121const agent = chai . request . agent ( server . app ) ;
2222
2323const Admin0 = util . account . staffAccounts [ 0 ] ;
24- const Hacker0 = util . account . hackerAccounts . stored . team [ 0 ] ;
24+ const teamHackerAccount0 = util . account . hackerAccounts . stored . team [ 0 ] ;
25+ const noTeamHackerAccount0 = util . account . hackerAccounts . stored . noTeam [ 0 ] ;
26+ const sponsorT1Account0 = util . account . sponsorT1Accounts . stored [ 0 ] ;
2527
2628describe ( "GET team" , function ( ) {
2729 it ( "should FAIL to list a team's information due to lack of authentication" , function ( done ) {
@@ -39,7 +41,7 @@ describe("GET team", function () {
3941 } ) ;
4042
4143 it ( "should Fail and list a team's information from /api/team/ GET due to non existant team id" , function ( done ) {
42- util . auth . login ( agent , util . account . Hacker4 , ( error ) => {
44+ util . auth . login ( agent , util . account . hackerAccounts . stored . team [ 0 ] , ( error ) => {
4345 if ( error ) {
4446 agent . close ( ) ;
4547 return done ( error ) ;
@@ -59,7 +61,7 @@ describe("GET team", function () {
5961 } ) ;
6062
6163 it ( "should SUCCEED and list a team's information from /api/team/ GET" , function ( done ) {
62- util . auth . login ( agent , util . account . Hacker3 , ( error ) => {
64+ util . auth . login ( agent , util . account . waitlistedHacker0 , ( error ) => {
6365 if ( error ) {
6466 agent . close ( ) ;
6567 return done ( error ) ;
@@ -108,7 +110,7 @@ describe("POST create team", function () {
108110 } ) ;
109111
110112 it ( "should FAIL to create a new team due to lack of authorization" , function ( done ) {
111- util . auth . login ( agent , util . account . Account3 , ( error ) => {
113+ util . auth . login ( agent , sponsorT1Account0 , ( error ) => {
112114 if ( error ) {
113115 agent . close ( ) ;
114116 return done ( error ) ;
@@ -152,7 +154,7 @@ describe("POST create team", function () {
152154 } ) ;
153155
154156 it ( "should FAIL to create a new team due to duplicate team name" , function ( done ) {
155- util . auth . login ( agent , util . account . Account2 , ( error ) => {
157+ util . auth . login ( agent , noTeamHackerAccount0 , ( error ) => {
156158 if ( error ) {
157159 agent . close ( ) ;
158160 return done ( error ) ;
@@ -175,7 +177,7 @@ describe("POST create team", function () {
175177 } ) ;
176178
177179 it ( "should Fail to create a new team due to hacker already being in a team" , function ( done ) {
178- util . auth . login ( agent , Hacker0 , ( error ) => {
180+ util . auth . login ( agent , teamHackerAccount0 , ( error ) => {
179181 if ( error ) {
180182 agent . close ( ) ;
181183 return done ( error ) ;
@@ -196,7 +198,7 @@ describe("POST create team", function () {
196198 } ) ;
197199
198200 it ( "should SUCCEED and create a new team" , function ( done ) {
199- util . auth . login ( agent , util . account . Account2 , ( error ) => {
201+ util . auth . login ( agent , noTeamHackerAccount0 , ( error ) => {
200202 if ( error ) {
201203 agent . close ( ) ;
202204 return done ( error ) ;
@@ -243,7 +245,7 @@ describe("PATCH join team", function () {
243245 } ) ;
244246
245247 it ( "should FAIL to join a volunteer to a team." , function ( done ) {
246- util . auth . login ( agent , util . account . Account5 , ( error ) => {
248+ util . auth . login ( agent , util . account . volunteerAccounts . stored [ 0 ] , ( error ) => {
247249 if ( error ) {
248250 agent . close ( ) ;
249251 return done ( error ) ;
@@ -267,7 +269,7 @@ describe("PATCH join team", function () {
267269 } ) ;
268270
269271 it ( "should FAIL to join a hacker to a team that doesn't exist." , function ( done ) {
270- util . auth . login ( agent , Hacker0 , ( error ) => {
272+ util . auth . login ( agent , teamHackerAccount0 , ( error ) => {
271273 if ( error ) {
272274 agent . close ( ) ;
273275 return done ( error ) ;
@@ -291,7 +293,7 @@ describe("PATCH join team", function () {
291293 } ) ;
292294
293295 it ( "should FAIL to join a hacker to a team that is full." , function ( done ) {
294- util . auth . login ( agent , Hacker0 , ( error ) => {
296+ util . auth . login ( agent , teamHackerAccount0 , ( error ) => {
295297 if ( error ) {
296298 agent . close ( ) ;
297299 return done ( error ) ;
@@ -315,7 +317,7 @@ describe("PATCH join team", function () {
315317 } ) ;
316318
317319 it ( "should SUCCEED and join a hacker without a team to a team." , function ( done ) {
318- util . auth . login ( agent , util . account . Account2 , ( error ) => {
320+ util . auth . login ( agent , noTeamHackerAccount0 , ( error ) => {
319321 if ( error ) {
320322 agent . close ( ) ;
321323 return done ( error ) ;
@@ -339,7 +341,7 @@ describe("PATCH join team", function () {
339341 } ) ;
340342
341343 it ( "should SUCCEED and join a hacker on a team to aother team." , function ( done ) {
342- util . auth . login ( agent , Hacker0 , ( error ) => {
344+ util . auth . login ( agent , teamHackerAccount0 , ( error ) => {
343345 if ( error ) {
344346 agent . close ( ) ;
345347 return done ( error ) ;
@@ -383,7 +385,7 @@ describe("PATCH change team info", function () {
383385 } ) ;
384386
385387 it ( "should FAIL for a hacker to change another team's information due to invalid authorization" , function ( done ) {
386- util . auth . login ( agent , util . account . Hacker4 , ( error ) => {
388+ util . auth . login ( agent , util . account . hackerAccounts . stored . team [ 1 ] , ( error ) => {
387389 if ( error ) {
388390 agent . close ( ) ;
389391 return done ( error ) ;
@@ -406,8 +408,8 @@ describe("PATCH change team info", function () {
406408 } ) ;
407409 } ) ;
408410
409- it ( "should SUCCEED to change the hacker's team information" , function ( done ) {
410- util . auth . login ( agent , util . account . Hacker4 , ( error ) => {
411+ it ( "should SUCCEED to change the hacker's team information (even though the hackers are different, the team is the same) " , function ( done ) {
412+ util . auth . login ( agent , util . account . hackerAccounts . stored . team [ 1 ] , ( error ) => {
411413 if ( error ) {
412414 agent . close ( ) ;
413415 return done ( error ) ;
@@ -432,7 +434,7 @@ describe("PATCH change team info", function () {
432434 } ) ;
433435
434436 it ( "should SUCCEED and leave a team." , function ( done ) {
435- util . auth . login ( agent , Hacker0 , ( error ) => {
437+ util . auth . login ( agent , teamHackerAccount0 , ( error ) => {
436438 if ( error ) {
437439 agent . close ( ) ;
438440 return done ( error ) ;
0 commit comments