Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. Jomik
    3. Posts
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    Posts made by Jomik

    • RE: BitBucket integration?

      Hey, you could easily use gulp/grunt to deploy to Screeps and then have your repo on BitBucket.

      I have a basic setup here: https://github.com/Jomik/screeps

      I prefer using a gulpfile over the GitHub integration anyway, since you can't move your scripts into multiple folders in Screeps. The gulpfile flattens the folder structure when deploying.

      posted in Feature Requests
      Jomik
    • RE: Unit tests for Screeps snippets

      I successfully solved this. I have a github repo where you can see how.

      https://github.com/Jomik/screeps

      posted in Help
      Jomik
    • RE: CPU usage for cancelOrder

      I am quite sure that it will use the CPU, as the CPU usage is from the method call itself, not the execution of the order.

      Take moveTo as an example, it has to calculate the path to the target, cancelling this will not remove the time that it has taken to calculate the path.

      posted in Help
      Jomik
    • Unit tests for Screeps snippets

      Hey,

      I'm kinda new to the whole JavaScript shenanigans, but I'm quite experienced with various languages.

      I'm used to, and would prefer, writing unit tests for my code, before writing the actual code. I have set up Mocha, and it seems to be working correctly. My issue is now that I can't test code that uses any Screeps function, since those are hidden away.
      I've never had to write tests for code outside of the environment, so to say. Is it possible to somehow work around this?

      I've made a function, 

      RoomPosition.prototype.getAdjacent = function(direction) { ... }

      Which takes a direction and returns the adjacent position in that direction. Now my issue is that I can't test this.

      It seems logical to do something like this:

      var assert = require('chai').assert;
      require('../../src/prototypes/prototype.RoomPosition')();
      describe('RoomPosition', function() {
      describe('#getAdjacent(direction)', function() {
      it('should return a new RoomPosition moved in the direction', function() {
      var pos = new RoomPosition(1, 1, 'TestingRoom');
      assert.equal(pos.getAdjacent(TOP), new RoomPosition(1, 0, 'TestingRoom'));
      });
      });
      });

      But, then I'd need to be able to somehow inject the constructor for RoomPosition, and also the values for the direction constants.

      Any help would be appreciated!

       

       

      posted in Help
      Jomik