Skip to content

Commit cb16574

Browse files
Merge pull request #322 from appwrite/feat-cookie-tests
2 parents 9d26779 + aed45b6 commit cb16574

File tree

9 files changed

+92
-51
lines changed

9 files changed

+92
-51
lines changed

composer.lock

Lines changed: 50 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/AndroidTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class AndroidTest extends Base
2020
...Base::GENERAL_RESPONSES,
2121
...Base::LARGE_FILE_RESPONSES,
2222
...Base::EXCEPTION_RESPONSES,
23-
...Base::REALTIME_RESPONSES
23+
...Base::REALTIME_RESPONSES,
24+
...Base::COOKIE_RESPONSES,
2425
];
2526
}

tests/Base.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ abstract class Base extends TestCase
3434
'POST:/v1/mock/tests/general/upload:passed',
3535
];
3636

37+
const COOKIE_RESPONSES = [
38+
'GET:/v1/mock/tests/general/set-cookie:passed',
39+
'GET:/v1/mock/tests/general/get-cookie:passed',
40+
];
41+
3742
const LARGE_FILE_RESPONSES = [
3843
'POST:/v1/mock/tests/general/upload:passed',
3944
];

tests/FlutterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ class FlutterTest extends Base
2020
...Base::LARGE_FILE_RESPONSES,
2121
...Base::EXCEPTION_RESPONSES,
2222
...Base::REALTIME_RESPONSES,
23+
...Base::COOKIE_RESPONSES,
2324
];
2425
}

tests/SwiftClientTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ class SwiftClientTest extends Base
2020
...Base::LARGE_FILE_RESPONSES,
2121
...Base::EXCEPTION_RESPONSES,
2222
...Base::REALTIME_RESPONSES,
23+
...Base::COOKIE_RESPONSES,
2324
];
2425
}

tests/languages/android/ServiceTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ class ServiceTest {
125125

126126
delay(5000)
127127
writeToFile(realtimeResponse)
128+
129+
mock = general.setCookie()
130+
writeToFile(mock.result)
131+
132+
mock = general.getCookie()
133+
writeToFile(mock.result)
128134
}
129135
}
130136

tests/languages/flutter/tests.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ void main() async {
100100

101101
await Future.delayed(Duration(seconds: 5));
102102

103-
// response = await general.setCookie();
104-
// print(response.result);
103+
response = await general.setCookie();
104+
print(response.result);
105105

106-
// response = await general.getCookie();
107-
// print(response.result);
106+
response = await general.getCookie();
107+
print(response.result);
108108
}

tests/languages/swift-client/Tests.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,25 @@ class Tests: XCTestCase {
196196

197197
wait(for: [expectation], timeout: 10.0)
198198
print( realtimeResponse)
199+
200+
group.enter()
201+
general.setCookie() { result in
202+
switch result {
203+
case .failure(let error): print( error.message)
204+
case .success(let mock): print( mock.result)
205+
}
206+
group.leave()
207+
}
208+
group.wait()
209+
210+
group.enter()
211+
general.getCookie() { result in
212+
switch result {
213+
case .failure(let error): print( error.message)
214+
case .success(let mock): print( mock.result)
215+
}
216+
group.leave()
217+
}
218+
group.wait()
199219
}
200220
}

tests/languages/web/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@
105105
console.log(error.message);
106106
}
107107

108-
setTimeout(() => console.log(responseRealtime), 5000);
108+
await Promise.resolve(resolve=>setTimeout(() => resolve, 5000));
109+
console.log(responseRealtime)
110+
109111
});
110112
</script>
111113
</body>

0 commit comments

Comments
 (0)