5e-database icon indicating copy to clipboard operation
5e-database copied to clipboard

CI Test for unformity

Open benjaminapetersen opened this issue 5 years ago • 3 comments

Thinking probably a mocha/chai script (or just plain ol' javascript really, no need to go crazy):

  • https://mochajs.org/#getting-started
  • https://www.chaijs.com/

First could be something simple like

describe("monsters", function() => {
    describe('JSON consistency', function() {
        it('should follow a consistent structure', function() {
           monsters.forEach((monster) => {
              expect(monster.name).to.be.a('string');
              expect(monster.size).to.be.a('string');
              expect(monster.armor_class).to.be.a('number');
              // etc etc.
              // more valuable for complex properties.
           });
      }); 
  });
});

benjaminapetersen avatar Jan 31 '20 15:01 benjaminapetersen

@bagelbits @ogregoire been off a bit but thinking about this one, since there are a lot of changes lately. changes are great! This would ensure they are uniform. Down side is the test has to be updated with the changes (but so long as they stay fairly simple, this is prob an upside as well).

benjaminapetersen avatar Jan 31 '20 15:01 benjaminapetersen

I mean this would lead towards more standardized Schemas, which would also make life easier to document them in the API as well. (I could definitely use help with documenting stuff but also it's kind of on me to do it).

bagelbits avatar Jan 31 '20 18:01 bagelbits

Just wanted to hop on this thread to say this would make it much easier for folks like me to maintain our API clients for the DnD project. Some sort of consistent schema checking is definitely a bigtime win in my book.

brittonhayes avatar Jan 14 '21 01:01 brittonhayes