-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from H9ko/36-mock-websocket
36 mock websocket
- Loading branch information
Showing
8 changed files
with
270 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,7 @@ jobs: | |
make build | ||
- name: Run linter | ||
run: make lint | ||
run: make lint | ||
|
||
- name: Run test | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
const getRemoveResponse = gameId => ({ | ||
data: JSON.stringify([null, null, 'lobby', 'game:remove', { id: gameId }]), | ||
}); | ||
const getRemoveResponse = gameId => (JSON.stringify([null, null, 'lobby', 'game:remove', { id: gameId }])); | ||
|
||
export default getRemoveResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
const getUpdateResponse = (gameId, state = 'waiting_opponent') => ({ | ||
data: JSON.stringify([null, | ||
null, | ||
'lobby', | ||
'game:upsert', | ||
{ | ||
game: { | ||
id: gameId, | ||
inserted_at: '2020-10-04T22:38:22', | ||
const getUpdateResponse = (gameId, state = 'waiting_opponent') => (JSON.stringify([null, | ||
null, | ||
'lobby', | ||
'game:upsert', | ||
{ | ||
game: { | ||
id: gameId, | ||
inserted_at: '2020-10-04T22:38:22', | ||
is_bot: false, | ||
level: 'elementary', | ||
players: [{ | ||
id: 2782, | ||
name: 'H9ko', | ||
is_bot: false, | ||
level: 'elementary', | ||
players: [{ | ||
id: 2782, | ||
name: 'H9ko', | ||
is_bot: false, | ||
github_id: 57991929, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], asserts_count: 0, output: '', result: '{"status": "info"}', status: 'initial', success_count: 0, | ||
}, | ||
achievements: ['played_ten_games', 'played_fifty_games'], | ||
rating: 1152, | ||
rating_diff: 0, | ||
}], | ||
state, | ||
timeout_seconds: 7200, | ||
type: 'public', | ||
}, | ||
}]), | ||
}); | ||
github_id: 57991929, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], asserts_count: 0, output: '', result: '{"status": "info"}', status: 'initial', success_count: 0, | ||
}, | ||
achievements: ['played_ten_games', 'played_fifty_games'], | ||
rating: 1152, | ||
rating_diff: 0, | ||
}], | ||
state, | ||
timeout_seconds: 7200, | ||
type: 'public', | ||
}, | ||
}])); | ||
|
||
export default getUpdateResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,159 +1,157 @@ | ||
export default { | ||
data: JSON.stringify([ | ||
'7', | ||
'7', | ||
'lobby', | ||
'phx_reply', | ||
{ | ||
response: { | ||
active_games: [ | ||
{ | ||
id: 19887, | ||
inserted_at: '2020-09-27T13:30:54', | ||
is_bot: true, | ||
level: 'medium', | ||
players: [ | ||
{ | ||
id: -27, | ||
name: 'HappyQleaner', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?clojure_cpp_csharp_golang_haskell_js_kotlin_php_python_ruby', | ||
], | ||
rating: 1365, | ||
rating_diff: 0, | ||
export default JSON.stringify([ | ||
'7', | ||
'7', | ||
'lobby', | ||
'phx_reply', | ||
{ | ||
response: { | ||
active_games: [ | ||
{ | ||
id: 19887, | ||
inserted_at: '2020-09-27T13:30:54', | ||
is_bot: true, | ||
level: 'medium', | ||
players: [ | ||
{ | ||
id: -27, | ||
name: 'HappyQleaner', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
{ | ||
id: 19923, | ||
inserted_at: '2020-09-28T12:17:11', | ||
is_bot: true, | ||
level: 'hard', | ||
players: [ | ||
{ | ||
id: -18, | ||
name: 'DenisPython', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?cpp_csharp_elixir_golang_haskell_java_js_php_python_ruby_ts', | ||
], | ||
rating: 1344, | ||
rating_diff: 0, | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?clojure_cpp_csharp_golang_haskell_js_kotlin_php_python_ruby', | ||
], | ||
rating: 1365, | ||
rating_diff: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
{ | ||
id: 19923, | ||
inserted_at: '2020-09-28T12:17:11', | ||
is_bot: true, | ||
level: 'hard', | ||
players: [ | ||
{ | ||
id: -18, | ||
name: 'DenisPython', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
{ | ||
id: 20011, | ||
inserted_at: '2020-09-30T16:15:49', | ||
is_bot: true, | ||
level: 'elementary', | ||
players: [ | ||
{ | ||
id: -9, | ||
name: 'UlaBack', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'ruby', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'ruby', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?cpp_csharp_elixir_haskell_java_js_php_python_ruby', | ||
], | ||
rating: 1261, | ||
rating_diff: 0, | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?cpp_csharp_elixir_golang_haskell_java_js_php_python_ruby_ts', | ||
], | ||
rating: 1344, | ||
rating_diff: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
{ | ||
id: 20011, | ||
inserted_at: '2020-09-30T16:15:49', | ||
is_bot: true, | ||
level: 'elementary', | ||
players: [ | ||
{ | ||
id: -9, | ||
name: 'UlaBack', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'ruby', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'ruby', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
{ | ||
id: 20013, | ||
inserted_at: '2020-09-30T17:14:20', | ||
is_bot: true, | ||
level: 'easy', | ||
players: [ | ||
{ | ||
id: -5, | ||
name: 'ValyaFront', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?clojure_cpp_elixir_golang_java_js_php_python_ruby', | ||
], | ||
rating: 1287, | ||
rating_diff: 0, | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?cpp_csharp_elixir_haskell_java_js_php_python_ruby', | ||
], | ||
rating: 1261, | ||
rating_diff: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
{ | ||
id: 20013, | ||
inserted_at: '2020-09-30T17:14:20', | ||
is_bot: true, | ||
level: 'easy', | ||
players: [ | ||
{ | ||
id: -5, | ||
name: 'ValyaFront', | ||
is_bot: true, | ||
github_id: 35539033, | ||
lang: 'js', | ||
editor_text: 'module.exports = () => {\n\n};', | ||
editor_lang: 'js', | ||
creator: true, | ||
game_result: 'undefined', | ||
check_result: { | ||
asserts: [], | ||
asserts_count: 0, | ||
output: '', | ||
result: '{"status": "info"}', | ||
status: 'initial', | ||
success_count: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
], | ||
}, | ||
status: 'ok', | ||
achievements: [ | ||
'played_hundred_games', | ||
'win_games_with?clojure_cpp_elixir_golang_java_js_php_python_ruby', | ||
], | ||
rating: 1287, | ||
rating_diff: 0, | ||
}, | ||
], | ||
state: 'waiting_opponent', | ||
timeout_seconds: 3600, | ||
type: 'bot', | ||
}, | ||
], | ||
}, | ||
]), | ||
}; | ||
status: 'ok', | ||
}, | ||
]); |
Oops, something went wrong.