/* eslint-disable no-unused-vars */

jasmine.getEnv().beforeAll(() => {
  jasmine.addMatchers({
    toBeUUIDv4: (util, customEqualityTesters) => {
      return {
        compare: (actual, expected) => {
          const reUUIDv4 = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$/;

          const result = {};
          result.pass = reUUIDv4.test(actual);

          if (!result.pass) {
            result.message = `Expected ${actual} to be a UUIDv4`;
          }

          return result;
        },
      };
    },
  });
});
