Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a functional test to check the /legal command #190

Closed
Tracked by #193
programarivm opened this issue Sep 20, 2023 · 7 comments
Closed
Tracked by #193

Write a functional test to check the /legal command #190

programarivm opened this issue Sep 20, 2023 · 7 comments
Assignees

Comments

@programarivm
Copy link
Member

programarivm commented Sep 20, 2023

Create a new file called tests/functional/LegalCommandTest.php and write a test in it called legal_e2() to check out that the following sequence of commands returns the expected response.

Commands:

/start classical fen
/legal e2

Response:

{"\/legal":{"color":"w","id":"P","fen":{"e3":"rnbqkbnr\/pppppppp\/8\/8\/8\/4P3\/PPPP1PPP\/RNBQKBNR b KQkq -","e4":"rnbqkbnr\/pppppppp\/8\/8\/4P3\/8\/PPPP1PPP\/RNBQKBNR b KQkq e3"}}}

Keep it up,

@kaifkh20
Copy link

I am interested in it and I have started working on it.
I just want to task, do I have to also run the command /start classical fen in legal_e2 function.
I am just asking because there is already a test case that does it for us.

@kaifkh20
Copy link

I have opened a PR, kindly see and let me know if it's alright or do I need to make some improvments.

@programarivm
Copy link
Member Author

programarivm commented Oct 3, 2023

@kaifkh20 it seems as though this issue needs some elaboration.

See:

Stay tuned!

@kaifkh20
Copy link

kaifkh20 commented Oct 4, 2023

Interesting..

@kaifkh20
Copy link

kaifkh20 commented Oct 4, 2023

I have found an another way of solving this issue without the need to rewrite the function..
Screenshot at 2023-10-04 21-02-37

In this, I have included the file StartCommandTest.php so that it can be used later in our file.

Screenshot at 2023-10-04 21-07-22

In this, I instantiated the object of StartCommand class and called the setUp function of that class inside our class so that it can be used right out of the box and then created a test function first which calls that function and then added a depended test which is our legal command test function.

@programarivm
Copy link
Member Author

Thank you @kaifkh20,

Can you please paste the code in a comment or commit the changes to the pull request branch?

Keep it up,

@kaifkh20
Copy link

kaifkh20 commented Oct 5, 2023

l have commited in my pr.
Kindly see..

@programarivm programarivm closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants