Skip to content

Commit 1528ca6

Browse files
Fixed tests for pushing and pulling 1 file
1 parent a966c11 commit 1528ca6

File tree

1 file changed

+45
-26
lines changed

1 file changed

+45
-26
lines changed

test/e2e.sh

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ function assertFolderDoesNotExists {
110110

111111

112112

113-
printf '\n[Auth test]\n'
113+
printf '\n\n[Auth test]\n'
114114

115115
result=$(gas auth)
116116
pattern="You are successfully authenticated as '.*' \[✔\]";
117-
assertRegex "auth returns succusfull" "$result" "$pattern"
117+
assertRegex "auth returns succesfull" "$result" "$pattern"
118118

119119

120120

121-
printf '\n[List, info and create test]\n'
121+
printf '\n\n[List, info and create test]\n'
122122

123123
result=$(gas list $projectName1)
124124
pattern="No script projects matching the filter found in your Google Drive \[✘\]"
@@ -163,7 +163,7 @@ assertRegex "gas list of the common prefix returns project1 and project2 wiht th
163163

164164

165165

166-
printf '\n[Rename test]\n'
166+
printf '\n\n[Rename test]\n'
167167

168168
result=$(gas info $projectId1)
169169
pattern="name: $projectName1.*id: $projectId1.*"
@@ -185,7 +185,7 @@ assertRegex "gas info of the id returns the new name" "$result" "$pattern"
185185

186186

187187

188-
printf "\n[Delete test]\n"
188+
printf "\n\n[Delete test]\n"
189189

190190
result=$(gas info $newProjectName1)
191191
pattern="name: $newProjectName1.*id: $projectId1.*"
@@ -224,7 +224,7 @@ pattern="No project with name or id '$projectId3' found in your Google Drive \[
224224
assertRegex "the project we deleted by id no longer exists by id" "$result" "$pattern"
225225

226226

227-
printf '\n[Link and pull test]\n'
227+
printf '\n\n[Link and pull test]\n'
228228

229229
result=$(gas info $projectId2)
230230
pattern="name: $projectName2.*id: $projectId2.*"
@@ -263,7 +263,7 @@ gas link $projectId2
263263

264264

265265

266-
printf '\n[Push, clone and status test]\n'
266+
printf '\n\n[Push and clone test]\n'
267267

268268
printf '//test1\n' > test1.js
269269
cd 'testFolder' || exit 1
@@ -340,7 +340,7 @@ assertRegex "The id ID file of our cloned project exists and return the correct
340340

341341

342342

343-
printf '\n[Status and pulling/pushing single files test]\n'
343+
printf '\n\n[Status and pulling/pushing single files test]\n'
344344

345345
# Project we are going to create should not exist yet
346346
result=$(gas list $projectName5)
@@ -354,9 +354,40 @@ result=$(gas info $projectName5)
354354
pattern="name: $projectName5.*id: (.{$idLenght}).*"
355355
assertRegex "Found the correct info for newly created project" "$result" "$pattern"
356356

357+
cd $projectName5 || exit 1
358+
mkdir 'folder'
359+
printf '//' > folder/modified1.js
360+
printf '//' > modified2.js
357361

362+
gas push
363+
364+
rm main.js
365+
printf '//added' > added.js
366+
printf '//modified' > folder/modified1.js
367+
printf '//modified2' > modified2.js
368+
369+
result=$(gas status)
370+
pattern="There are some difference between your local files and Google Drive for '$projectName5'.*\+ added\.js.*~ folder/modified1\.js.*~ modified2\.js.*- main\.js.*"
371+
assertRegex "1 added, 2 modified and 1 removed file" "$result" "$pattern"
372+
373+
gas push added.js
374+
gas push folder/modified1.js
358375

359-
printf '\n[New test]\n'
376+
result=$(gas status)
377+
pattern="There are some difference between your local files and Google Drive for '$projectName5'.*~ modified2\.js.*- main\.js.*"
378+
assertRegex "1 modified and 1 removed file" "$result" "$pattern"
379+
380+
gas pull main.js
381+
382+
result=$(gas status)
383+
pattern="There are some difference between your local files and Google Drive for '$projectName5'.*~ modified2\.js.*"
384+
assertRegex "1 modified file" "$result" "$pattern"
385+
386+
cd ..
387+
388+
389+
390+
printf '\n\n[New test]\n'
360391

361392
# Project we are going to create should not exist yet
362393
result=$(gas list $projectName6)
@@ -381,35 +412,23 @@ assertRegex "the .gas/ID file for project6 exists" "$result" "$projectId6"
381412

382413

383414

384-
printf '\n[Include test]\n'
385-
415+
printf '\n\n[Include test]\n'
416+
printf '#TODO'
386417
# do gas include
387418
# check that include file has been created
388419

389-
# write an include file
390-
# cd $projectRootFolder2 || exit 1
391-
# printf '//test1\n' > test1.js
392-
# mkdir 'testFolder' && cd 'testFolder' || exit 1
393-
# printf '//test2\n' > test2.js
394-
# cd ..
395-
# mkdir 'testFolder2' && cd 'testFolder2' || exit 1
396-
# mkdir 'testFolder3' && cd 'testFolder3' || exit 1
397-
# printf '//test3\n' > test3.js
398-
# cd ..
399-
# cd ..
400-
# gas push
401-
# cd ..
402-
403420

404421

405422
# Cleaning up at the end by deleting remaining projects and folders
406-
printf '\n[Cleaning up]\n'
423+
printf '\n\n[Cleaning up]\n'
407424
gas delete $projectId2
408425
gas delete $projectName4
409426
gas delete $projectName5
427+
gas delete $projectName6
410428
rm -r $projectName2
411429
rm -r $projectRootFolder2
412430
rm -r $projectName5
431+
rm -r $projectName6
413432

414433

415434
printf "____________________________________________\n"

0 commit comments

Comments
 (0)