mgrs icon indicating copy to clipboard operation
mgrs copied to clipboard

replace mocha+chai with flug?

Open DanielJDufour opened this issue 1 year ago • 0 comments

I'm weighing the pros and cons of replacing mocha and chai with flug.

Although they are popular, dependabot occasionally flags security vulnerabilities with these libraries and I'd rather not bother with the hassle if there is an alternative. Additionally, I prefer the simpler syntax of flug.

with mocha + cai

const should = require('chai').should(); // eslint-disable-line no-unused-vars

describe ('third mgrs set', () => {
  const mgrsStr = '11SPA7234911844';
  const point = [-115.0820944, 36.2361322];
  it('MGRS reference with highest accuracy correct.', () => {
    mgrs.forward(point).should.equal(mgrsStr);
  });
  it('MGRS reference with 0-digit accuracy correct.', () => {
    mgrs.forward(point, 0).should.equal('11SPA');
  });
});

with flug

test('third mgrs set', ({ eq }) => {
  const mgrsStr = '11SPA7234911844';
  const point = [-115.0820944, 36.2361322];
  eq(mgrs.forward(point), mgrsStr); // with highest accuracy
  eq(mgrs.forward(point, 0), '11SPA'); // with 0-digit accuracy
});

Open to your thoughts and opinions!

DanielJDufour avatar Mar 18 '23 23:03 DanielJDufour