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

Tests #23

Closed
henopied opened this issue Oct 11, 2015 · 10 comments
Closed

Tests #23

henopied opened this issue Oct 11, 2015 · 10 comments

Comments

@henopied
Copy link
Contributor

Just wondering do you have any code tests for this client, if so could you please use travis with this project? I would love to have tests so I could add my own features with confidence.

@pulviscriptor
Copy link
Owner

Hi.
I do not have any tests, and i do not think such little project needs any. But i'm not very experienced with tests so i may be wrong.
Currently i do not plan to make any tests.

@henopied
Copy link
Contributor Author

Should I make a pr with tests in hopefully the near future?

@henopied
Copy link
Contributor Author

so far I have a basic test for the getFFAServer function:

var expect = require('chai').expect;
var agarClient = require('agario-client');
var client = new agarClient('tester');
var ping = require('ping');

describe('agarClient', function() {
    describe('#servers', function() {
        describe('#getFFAServer', function() {
            it('should find a server to connect to', function() {
                agarClient.servers.getFFAServer({region: 'EU-London'}, function(srv) { //requesting FFA server
                    expect(srv.server).to.be.a('string');
                });
            });
            it('should find a *valid* server to connect to', function() {
                agarClient.servers.getFFAServer({region: 'EU-London'}, function(srv) { //requesting FFA server
                    ping.sys.probe(srv.server, function(isAlive) {
                        expect(isAlive).to.equal(true);
                    });
                });
            });
        });
    });
});

@pulviscriptor
Copy link
Owner

henopied,
Uhm... Tests is too hard for me. Coding is just my hobby and tests it too hard.
Maybe someday i will learn them to understand how they works, but not now.
Let's leave agario-client without tests at the current moment.

@henopied
Copy link
Contributor Author

If that is how you feel I am alright if there are no tests, although I do feel test would be of benefit to the project. If I make all the tests would you use them?

@pulviscriptor
Copy link
Owner

What i'm trying to say, i don't understand tests thing for agario-client.
In example getFFAServer test. Sometimes agar.io provides non-working IP addresses, and that will cause test to fail but problem is not in agario-client.
Or if we do client.moveTo() test and client will be eaten immediately after spawn and client will be not able to moveTo() and that will be fail too, but client is working.
So because of that i don't think agario-client is good place for tests.
I may be wrong. I don't know.
If you sure that tests is good and will work, you can PR and i will accept them.

@henopied
Copy link
Contributor Author

When does agar provide non working ips? and for the moveto function I could test if the bot is even alive. I was also debating whether or not to make it create an ogar server for some of the in game functions.

@pulviscriptor
Copy link
Owner

When does agar provide non working ips?

It happens sometimes in region EU-London for me in example.js. Yesterday when i was making bot for issue #22 i got non-working server once.
Currently i can not reproduce it, all servers are working at the moment.

I could test if the bot is even alive

That will solve .moveTo() for that problem. But there can be others i think.

I could test if the bot is even alive

To be honest i don't like this idea. Tests will test if ogar is compatible with client, but not agar.

I still don't like tests idea, but you can ignore me and PR and i will accept since i have no experience with tests and you do and you better know what are you doing.

@henopied
Copy link
Contributor Author

could the ips be checked through regex? and I do agree some things just cant be tested. Ogar may not be exactly like the official agar implementation but it could be used for testing and after all it does work with the official agar client so it should work with yours (not necessarily but it should.)

@pulviscriptor
Copy link
Owner

In current situation you are the leader, do whatever you think need to be done. You have experience and knowledge.
*Testing IP with regex i like much better.
**I may go to sleep now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants