@geekmidas/testkit 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{Factory-B9LP1L18.d.cts → Factory-Bm44VKa-.d.cts} +1 -1
  2. package/dist/{Factory-DiZSNxC0.d.mts → Factory-tjCDNgUK.d.mts} +1 -1
  3. package/dist/Factory.d.cts +2 -2
  4. package/dist/Factory.d.mts +2 -2
  5. package/dist/{KyselyFactory-B-zlLbov.d.mts → KyselyFactory-BoPDDitt.d.cts} +2 -2
  6. package/dist/{KyselyFactory-ELiHgHVv.mjs → KyselyFactory-C3Bc3p4L.mjs} +1 -1
  7. package/dist/{KyselyFactory-Bdq1s1Go.cjs → KyselyFactory-CXtfmMfK.cjs} +1 -1
  8. package/dist/{KyselyFactory-CrLWxJW4.d.cts → KyselyFactory-D82j74t9.d.mts} +2 -2
  9. package/dist/KyselyFactory.cjs +2 -2
  10. package/dist/KyselyFactory.d.cts +3 -3
  11. package/dist/KyselyFactory.d.mts +3 -3
  12. package/dist/KyselyFactory.mjs +2 -2
  13. package/dist/{ObjectionFactory-CJCpvwts.d.mts → ObjectionFactory-BWMTXsxH.d.cts} +2 -2
  14. package/dist/{ObjectionFactory-vME-wNlq.d.cts → ObjectionFactory-CEG5qUrm.d.mts} +2 -2
  15. package/dist/{ObjectionFactory-Wq80ypMM.cjs → ObjectionFactory-DxIxJagq.cjs} +1 -1
  16. package/dist/{ObjectionFactory-aqM0dDW7.mjs → ObjectionFactory-qIICOph3.mjs} +1 -1
  17. package/dist/ObjectionFactory.cjs +2 -2
  18. package/dist/ObjectionFactory.d.cts +3 -3
  19. package/dist/ObjectionFactory.d.mts +3 -3
  20. package/dist/ObjectionFactory.mjs +2 -2
  21. package/dist/__tests__/KyselyFactory.spec.cjs +2 -2
  22. package/dist/__tests__/KyselyFactory.spec.mjs +2 -2
  23. package/dist/__tests__/ObjectionFactory.spec.cjs +2 -2
  24. package/dist/__tests__/ObjectionFactory.spec.mjs +2 -2
  25. package/dist/__tests__/VitestObjectionTransactionIsolator.spec.cjs +2 -2
  26. package/dist/__tests__/VitestObjectionTransactionIsolator.spec.mjs +2 -2
  27. package/dist/__tests__/faker.spec.cjs +1 -1
  28. package/dist/__tests__/faker.spec.mjs +1 -1
  29. package/dist/__tests__/integration.spec.cjs +2 -2
  30. package/dist/__tests__/integration.spec.mjs +2 -2
  31. package/dist/example.cjs +2 -2
  32. package/dist/example.d.cts +1 -1
  33. package/dist/example.d.mts +1 -1
  34. package/dist/example.mjs +2 -2
  35. package/dist/{faker-SMN4ira4.cjs → faker-B14IEMIN.cjs} +41 -1
  36. package/dist/{faker-CxKkEeYi.mjs → faker-BGKYFoCT.mjs} +36 -2
  37. package/dist/{faker-nN9Ki6fn.d.mts → faker-ChuHaYMR.d.mts} +11 -1
  38. package/dist/{faker-DAiFK3T3.d.cts → faker-km9UhOS6.d.cts} +11 -1
  39. package/dist/faker.cjs +2 -1
  40. package/dist/faker.d.cts +2 -2
  41. package/dist/faker.d.mts +2 -2
  42. package/dist/faker.mjs +2 -2
  43. package/dist/kysely.cjs +2 -2
  44. package/dist/kysely.d.cts +3 -3
  45. package/dist/kysely.d.mts +3 -3
  46. package/dist/kysely.mjs +2 -2
  47. package/dist/objection.cjs +2 -2
  48. package/dist/objection.d.cts +3 -3
  49. package/dist/objection.d.mts +3 -3
  50. package/dist/objection.mjs +2 -2
  51. package/package.json +1 -1
  52. package/src/faker.ts +86 -0
@@ -1,4 +1,4 @@
1
- import { FakerFactory } from "./faker-DAiFK3T3.cjs";
1
+ import { FakerFactory } from "./faker-km9UhOS6.cjs";
2
2
 
3
3
  //#region src/Factory.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
- import { FakerFactory } from "./faker-nN9Ki6fn.mjs";
1
+ import { FakerFactory } from "./faker-ChuHaYMR.mjs";
2
2
 
3
3
  //#region src/Factory.d.ts
4
4
 
@@ -1,3 +1,3 @@
1
- import "./faker-DAiFK3T3.cjs";
2
- import { Factory, FactorySeed, MixedFactoryBuilder } from "./Factory-B9LP1L18.cjs";
1
+ import "./faker-km9UhOS6.cjs";
2
+ import { Factory, FactorySeed, MixedFactoryBuilder } from "./Factory-Bm44VKa-.cjs";
3
3
  export { Factory, FactorySeed, MixedFactoryBuilder };
@@ -1,3 +1,3 @@
1
- import "./faker-nN9Ki6fn.mjs";
2
- import { Factory, FactorySeed, MixedFactoryBuilder } from "./Factory-DiZSNxC0.mjs";
1
+ import "./faker-ChuHaYMR.mjs";
2
+ import { Factory, FactorySeed, MixedFactoryBuilder } from "./Factory-tjCDNgUK.mjs";
3
3
  export { Factory, FactorySeed, MixedFactoryBuilder };
@@ -1,5 +1,5 @@
1
- import { FakerFactory } from "./faker-nN9Ki6fn.mjs";
2
- import { Factory, FactorySeed } from "./Factory-DiZSNxC0.mjs";
1
+ import { FakerFactory } from "./faker-km9UhOS6.cjs";
2
+ import { Factory, FactorySeed } from "./Factory-Bm44VKa-.cjs";
3
3
  import { ControlledTransaction, Insertable, Kysely, Selectable } from "kysely";
4
4
 
5
5
  //#region src/KyselyFactory.d.ts
@@ -1,5 +1,5 @@
1
1
  import { Factory } from "./Factory-z2m01hMj.mjs";
2
- import { faker } from "./faker-CxKkEeYi.mjs";
2
+ import { faker } from "./faker-BGKYFoCT.mjs";
3
3
 
4
4
  //#region src/KyselyFactory.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  const require_Factory = require('./Factory-WMhTNZ9S.cjs');
2
- const require_faker = require('./faker-SMN4ira4.cjs');
2
+ const require_faker = require('./faker-B14IEMIN.cjs');
3
3
 
4
4
  //#region src/KyselyFactory.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { FakerFactory } from "./faker-DAiFK3T3.cjs";
2
- import { Factory, FactorySeed } from "./Factory-B9LP1L18.cjs";
1
+ import { FakerFactory } from "./faker-ChuHaYMR.mjs";
2
+ import { Factory, FactorySeed } from "./Factory-tjCDNgUK.mjs";
3
3
  import { ControlledTransaction, Insertable, Kysely, Selectable } from "kysely";
4
4
 
5
5
  //#region src/KyselyFactory.d.ts
@@ -1,5 +1,5 @@
1
1
  require('./Factory-WMhTNZ9S.cjs');
2
- require('./faker-SMN4ira4.cjs');
3
- const require_KyselyFactory = require('./KyselyFactory-Bdq1s1Go.cjs');
2
+ require('./faker-B14IEMIN.cjs');
3
+ const require_KyselyFactory = require('./KyselyFactory-CXtfmMfK.cjs');
4
4
 
5
5
  exports.KyselyFactory = require_KyselyFactory.KyselyFactory;
@@ -1,4 +1,4 @@
1
- import "./faker-DAiFK3T3.cjs";
2
- import "./Factory-B9LP1L18.cjs";
3
- import { KyselyFactory } from "./KyselyFactory-CrLWxJW4.cjs";
1
+ import "./faker-km9UhOS6.cjs";
2
+ import "./Factory-Bm44VKa-.cjs";
3
+ import { KyselyFactory } from "./KyselyFactory-BoPDDitt.cjs";
4
4
  export { KyselyFactory };
@@ -1,4 +1,4 @@
1
- import "./faker-nN9Ki6fn.mjs";
2
- import "./Factory-DiZSNxC0.mjs";
3
- import { KyselyFactory } from "./KyselyFactory-B-zlLbov.mjs";
1
+ import "./faker-ChuHaYMR.mjs";
2
+ import "./Factory-tjCDNgUK.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-D82j74t9.mjs";
4
4
  export { KyselyFactory };
@@ -1,5 +1,5 @@
1
1
  import "./Factory-z2m01hMj.mjs";
2
- import "./faker-CxKkEeYi.mjs";
3
- import { KyselyFactory } from "./KyselyFactory-ELiHgHVv.mjs";
2
+ import "./faker-BGKYFoCT.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-C3Bc3p4L.mjs";
4
4
 
5
5
  export { KyselyFactory };
@@ -1,5 +1,5 @@
1
- import { FakerFactory } from "./faker-nN9Ki6fn.mjs";
2
- import { Factory, FactorySeed } from "./Factory-DiZSNxC0.mjs";
1
+ import { FakerFactory } from "./faker-km9UhOS6.cjs";
2
+ import { Factory, FactorySeed } from "./Factory-Bm44VKa-.cjs";
3
3
  import { Knex } from "knex";
4
4
  import { Model } from "objection";
5
5
 
@@ -1,5 +1,5 @@
1
- import { FakerFactory } from "./faker-DAiFK3T3.cjs";
2
- import { Factory, FactorySeed } from "./Factory-B9LP1L18.cjs";
1
+ import { FakerFactory } from "./faker-ChuHaYMR.mjs";
2
+ import { Factory, FactorySeed } from "./Factory-tjCDNgUK.mjs";
3
3
  import { Knex } from "knex";
4
4
  import { Model } from "objection";
5
5
 
@@ -1,5 +1,5 @@
1
1
  const require_Factory = require('./Factory-WMhTNZ9S.cjs');
2
- const require_faker = require('./faker-SMN4ira4.cjs');
2
+ const require_faker = require('./faker-B14IEMIN.cjs');
3
3
 
4
4
  //#region src/ObjectionFactory.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Factory } from "./Factory-z2m01hMj.mjs";
2
- import { faker } from "./faker-CxKkEeYi.mjs";
2
+ import { faker } from "./faker-BGKYFoCT.mjs";
3
3
 
4
4
  //#region src/ObjectionFactory.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  require('./Factory-WMhTNZ9S.cjs');
2
- require('./faker-SMN4ira4.cjs');
3
- const require_ObjectionFactory = require('./ObjectionFactory-Wq80ypMM.cjs');
2
+ require('./faker-B14IEMIN.cjs');
3
+ const require_ObjectionFactory = require('./ObjectionFactory-DxIxJagq.cjs');
4
4
 
5
5
  exports.ObjectionFactory = require_ObjectionFactory.ObjectionFactory;
@@ -1,4 +1,4 @@
1
- import "./faker-DAiFK3T3.cjs";
2
- import "./Factory-B9LP1L18.cjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-vME-wNlq.cjs";
1
+ import "./faker-km9UhOS6.cjs";
2
+ import "./Factory-Bm44VKa-.cjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-BWMTXsxH.cjs";
4
4
  export { ObjectionFactory };
@@ -1,4 +1,4 @@
1
- import "./faker-nN9Ki6fn.mjs";
2
- import "./Factory-DiZSNxC0.mjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-CJCpvwts.mjs";
1
+ import "./faker-ChuHaYMR.mjs";
2
+ import "./Factory-tjCDNgUK.mjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-CEG5qUrm.mjs";
4
4
  export { ObjectionFactory };
@@ -1,5 +1,5 @@
1
1
  import "./Factory-z2m01hMj.mjs";
2
- import "./faker-CxKkEeYi.mjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-aqM0dDW7.mjs";
2
+ import "./faker-BGKYFoCT.mjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-qIICOph3.mjs";
4
4
 
5
5
  export { ObjectionFactory };
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require('../chunk-CUT6urMc.cjs');
2
2
  require('../Factory-WMhTNZ9S.cjs');
3
- require('../faker-SMN4ira4.cjs');
4
- const require_KyselyFactory = require('../KyselyFactory-Bdq1s1Go.cjs');
3
+ require('../faker-B14IEMIN.cjs');
4
+ const require_KyselyFactory = require('../KyselyFactory-CXtfmMfK.cjs');
5
5
  require('../PostgresMigrator-DFcNdCvD.cjs');
6
6
  require('../PostgresKyselyMigrator-CfytARcA.cjs');
7
7
  require('../VitestTransactionIsolator-CruLTRRi.cjs');
@@ -1,6 +1,6 @@
1
1
  import "../Factory-z2m01hMj.mjs";
2
- import "../faker-CxKkEeYi.mjs";
3
- import { KyselyFactory } from "../KyselyFactory-ELiHgHVv.mjs";
2
+ import "../faker-BGKYFoCT.mjs";
3
+ import { KyselyFactory } from "../KyselyFactory-C3Bc3p4L.mjs";
4
4
  import "../PostgresMigrator-DxPC_gGu.mjs";
5
5
  import "../PostgresKyselyMigrator-Bdhl251C.mjs";
6
6
  import "../VitestTransactionIsolator-BWwK-ca6.mjs";
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require('../chunk-CUT6urMc.cjs');
2
2
  require('../Factory-WMhTNZ9S.cjs');
3
- const require_faker = require('../faker-SMN4ira4.cjs');
4
- const require_ObjectionFactory = require('../ObjectionFactory-Wq80ypMM.cjs');
3
+ const require_faker = require('../faker-B14IEMIN.cjs');
4
+ const require_ObjectionFactory = require('../ObjectionFactory-DxIxJagq.cjs');
5
5
  const require_helpers = require('../helpers-CNMBePuj.cjs');
6
6
  const vitest = require_chunk.__toESM(require("vitest"));
7
7
  const objection = require_chunk.__toESM(require("objection"));
@@ -1,6 +1,6 @@
1
1
  import "../Factory-z2m01hMj.mjs";
2
- import { faker } from "../faker-CxKkEeYi.mjs";
3
- import { ObjectionFactory } from "../ObjectionFactory-aqM0dDW7.mjs";
2
+ import { faker } from "../faker-BGKYFoCT.mjs";
3
+ import { ObjectionFactory } from "../ObjectionFactory-qIICOph3.mjs";
4
4
  import { setupKnexTest } from "../helpers-BEmjyUVE.mjs";
5
5
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
6
6
  import { Model } from "objection";
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require('../chunk-CUT6urMc.cjs');
2
2
  require('../Factory-WMhTNZ9S.cjs');
3
- require('../faker-SMN4ira4.cjs');
4
- require('../ObjectionFactory-Wq80ypMM.cjs');
3
+ require('../faker-B14IEMIN.cjs');
4
+ require('../ObjectionFactory-DxIxJagq.cjs');
5
5
  require('../PostgresMigrator-DFcNdCvD.cjs');
6
6
  require('../PostgresObjectionMigrator-BG6ymgnt.cjs');
7
7
  require('../VitestTransactionIsolator-CruLTRRi.cjs');
@@ -1,6 +1,6 @@
1
1
  import "../Factory-z2m01hMj.mjs";
2
- import "../faker-CxKkEeYi.mjs";
3
- import "../ObjectionFactory-aqM0dDW7.mjs";
2
+ import "../faker-BGKYFoCT.mjs";
3
+ import "../ObjectionFactory-qIICOph3.mjs";
4
4
  import "../PostgresMigrator-DxPC_gGu.mjs";
5
5
  import "../PostgresObjectionMigrator-G4h5FLvU.mjs";
6
6
  import "../VitestTransactionIsolator-BWwK-ca6.mjs";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('../chunk-CUT6urMc.cjs');
2
- const require_faker = require('../faker-SMN4ira4.cjs');
2
+ const require_faker = require('../faker-B14IEMIN.cjs');
3
3
  const vitest = require_chunk.__toESM(require("vitest"));
4
4
 
5
5
  //#region src/__tests__/faker.spec.ts
@@ -1,4 +1,4 @@
1
- import { faker } from "../faker-CxKkEeYi.mjs";
1
+ import { faker } from "../faker-BGKYFoCT.mjs";
2
2
  import { beforeEach, describe, expect, it } from "vitest";
3
3
 
4
4
  //#region src/__tests__/faker.spec.ts
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require('../chunk-CUT6urMc.cjs');
2
2
  require('../Factory-WMhTNZ9S.cjs');
3
- require('../faker-SMN4ira4.cjs');
4
- const require_KyselyFactory = require('../KyselyFactory-Bdq1s1Go.cjs');
3
+ require('../faker-B14IEMIN.cjs');
4
+ const require_KyselyFactory = require('../KyselyFactory-CXtfmMfK.cjs');
5
5
  require('../PostgresMigrator-DFcNdCvD.cjs');
6
6
  require('../PostgresKyselyMigrator-CfytARcA.cjs');
7
7
  require('../VitestTransactionIsolator-CruLTRRi.cjs');
@@ -1,6 +1,6 @@
1
1
  import "../Factory-z2m01hMj.mjs";
2
- import "../faker-CxKkEeYi.mjs";
3
- import { KyselyFactory } from "../KyselyFactory-ELiHgHVv.mjs";
2
+ import "../faker-BGKYFoCT.mjs";
3
+ import { KyselyFactory } from "../KyselyFactory-C3Bc3p4L.mjs";
4
4
  import "../PostgresMigrator-DxPC_gGu.mjs";
5
5
  import "../PostgresKyselyMigrator-Bdhl251C.mjs";
6
6
  import "../VitestTransactionIsolator-BWwK-ca6.mjs";
package/dist/example.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  require('./Factory-WMhTNZ9S.cjs');
2
- require('./faker-SMN4ira4.cjs');
3
- const require_KyselyFactory = require('./KyselyFactory-Bdq1s1Go.cjs');
2
+ require('./faker-B14IEMIN.cjs');
3
+ const require_KyselyFactory = require('./KyselyFactory-CXtfmMfK.cjs');
4
4
 
5
5
  //#region src/example.ts
6
6
  const userBuilder = require_KyselyFactory.KyselyFactory.createBuilder({
@@ -1,4 +1,4 @@
1
- import { FakerFactory } from "./faker-DAiFK3T3.cjs";
1
+ import { FakerFactory } from "./faker-km9UhOS6.cjs";
2
2
  import * as kysely0 from "kysely";
3
3
 
4
4
  //#region src/example.d.ts
@@ -1,4 +1,4 @@
1
- import { FakerFactory } from "./faker-nN9Ki6fn.mjs";
1
+ import { FakerFactory } from "./faker-ChuHaYMR.mjs";
2
2
  import * as kysely0 from "kysely";
3
3
 
4
4
  //#region src/example.d.ts
package/dist/example.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./Factory-z2m01hMj.mjs";
2
- import "./faker-CxKkEeYi.mjs";
3
- import { KyselyFactory } from "./KyselyFactory-ELiHgHVv.mjs";
2
+ import "./faker-BGKYFoCT.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-C3Bc3p4L.mjs";
4
4
 
5
5
  //#region src/example.ts
6
6
  const userBuilder = KyselyFactory.createBuilder({
@@ -196,6 +196,36 @@ function resetAllSequences() {
196
196
  function price() {
197
197
  return +faker.commerce.price();
198
198
  }
199
+ function coordinateInRadius(center, radius) {
200
+ const earth = 6378137;
201
+ const d = radius / earth;
202
+ const theta = 2 * Math.PI * Math.random();
203
+ const r = d * Math.sqrt(Math.random());
204
+ const lat1 = center.lat * Math.PI / 180;
205
+ const lng1 = center.lng * Math.PI / 180;
206
+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
207
+ const lng2 = lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2));
208
+ return {
209
+ lat: lat2 * 180 / Math.PI,
210
+ lng: lng2 * 180 / Math.PI
211
+ };
212
+ }
213
+ function coordinateOutsideRadius(center, minRadiusMeters, maxRadiusMeters) {
214
+ const earth = 6378137;
215
+ const minD = minRadiusMeters / earth;
216
+ const maxD = maxRadiusMeters / earth;
217
+ const theta = 2 * Math.PI * Math.random();
218
+ const r = Math.sqrt(minD * minD + (maxD * maxD - minD * minD) * Math.random());
219
+ const lat1 = center.lat * Math.PI / 180;
220
+ const lng1 = center.lng * Math.PI / 180;
221
+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
222
+ const lng2 = lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2));
223
+ const normalizedLng = (lng2 * 180 / Math.PI + 540) % 360 - 180;
224
+ return {
225
+ lat: lat2 * 180 / Math.PI,
226
+ lng: normalizedLng
227
+ };
228
+ }
199
229
  /**
200
230
  * Enhanced faker instance with additional utility methods for testing.
201
231
  * Extends @faker-js/faker with custom methods for common test data generation patterns.
@@ -221,10 +251,20 @@ const faker = Object.freeze(Object.assign({}, __faker_js_faker.faker, {
221
251
  sequence,
222
252
  resetSequence,
223
253
  resetAllSequences,
224
- price
254
+ price,
255
+ coordinates: {
256
+ within: coordinateInRadius,
257
+ outside: coordinateOutsideRadius
258
+ }
225
259
  }));
226
260
 
227
261
  //#endregion
262
+ Object.defineProperty(exports, 'coordinateInRadius', {
263
+ enumerable: true,
264
+ get: function () {
265
+ return coordinateInRadius;
266
+ }
267
+ });
228
268
  Object.defineProperty(exports, 'faker', {
229
269
  enumerable: true,
230
270
  get: function () {
@@ -195,6 +195,36 @@ function resetAllSequences() {
195
195
  function price() {
196
196
  return +faker$1.commerce.price();
197
197
  }
198
+ function coordinateInRadius(center, radius) {
199
+ const earth = 6378137;
200
+ const d = radius / earth;
201
+ const theta = 2 * Math.PI * Math.random();
202
+ const r = d * Math.sqrt(Math.random());
203
+ const lat1 = center.lat * Math.PI / 180;
204
+ const lng1 = center.lng * Math.PI / 180;
205
+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
206
+ const lng2 = lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2));
207
+ return {
208
+ lat: lat2 * 180 / Math.PI,
209
+ lng: lng2 * 180 / Math.PI
210
+ };
211
+ }
212
+ function coordinateOutsideRadius(center, minRadiusMeters, maxRadiusMeters) {
213
+ const earth = 6378137;
214
+ const minD = minRadiusMeters / earth;
215
+ const maxD = maxRadiusMeters / earth;
216
+ const theta = 2 * Math.PI * Math.random();
217
+ const r = Math.sqrt(minD * minD + (maxD * maxD - minD * minD) * Math.random());
218
+ const lat1 = center.lat * Math.PI / 180;
219
+ const lng1 = center.lng * Math.PI / 180;
220
+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
221
+ const lng2 = lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2));
222
+ const normalizedLng = (lng2 * 180 / Math.PI + 540) % 360 - 180;
223
+ return {
224
+ lat: lat2 * 180 / Math.PI,
225
+ lng: normalizedLng
226
+ };
227
+ }
198
228
  /**
199
229
  * Enhanced faker instance with additional utility methods for testing.
200
230
  * Extends @faker-js/faker with custom methods for common test data generation patterns.
@@ -220,8 +250,12 @@ const faker$1 = Object.freeze(Object.assign({}, faker, {
220
250
  sequence,
221
251
  resetSequence,
222
252
  resetAllSequences,
223
- price
253
+ price,
254
+ coordinates: {
255
+ within: coordinateInRadius,
256
+ outside: coordinateOutsideRadius
257
+ }
224
258
  }));
225
259
 
226
260
  //#endregion
227
- export { faker$1 as faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
261
+ export { coordinateInRadius, faker$1 as faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
@@ -109,6 +109,12 @@ declare function resetAllSequences(): void;
109
109
  * ```
110
110
  */
111
111
  declare function price(): number;
112
+ type Coordinate = {
113
+ lat: number;
114
+ lng: number;
115
+ };
116
+ declare function coordinateInRadius(center: Coordinate, radius: number): Coordinate;
117
+ declare function coordinateOutsideRadius(center: Coordinate, minRadiusMeters: number, maxRadiusMeters: number): Coordinate;
112
118
  /**
113
119
  * Enhanced faker instance with additional utility methods for testing.
114
120
  * Extends @faker-js/faker with custom methods for common test data generation patterns.
@@ -135,6 +141,10 @@ declare const faker$1: Readonly<_faker_js_faker4.Faker & {
135
141
  resetSequence: typeof resetSequence;
136
142
  resetAllSequences: typeof resetAllSequences;
137
143
  price: typeof price;
144
+ coordinates: {
145
+ within: typeof coordinateInRadius;
146
+ outside: typeof coordinateOutsideRadius;
147
+ };
138
148
  }>;
139
149
  /**
140
150
  * Type definition for timestamp fields.
@@ -152,4 +162,4 @@ type Timestamps = {
152
162
  */
153
163
  type FakerFactory = typeof faker$1;
154
164
  //#endregion
155
- export { FakerFactory, Timestamps, faker$1 as faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
165
+ export { FakerFactory, Timestamps, coordinateInRadius, faker$1 as faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
@@ -109,6 +109,12 @@ declare function resetAllSequences(): void;
109
109
  * ```
110
110
  */
111
111
  declare function price(): number;
112
+ type Coordinate = {
113
+ lat: number;
114
+ lng: number;
115
+ };
116
+ declare function coordinateInRadius(center: Coordinate, radius: number): Coordinate;
117
+ declare function coordinateOutsideRadius(center: Coordinate, minRadiusMeters: number, maxRadiusMeters: number): Coordinate;
112
118
  /**
113
119
  * Enhanced faker instance with additional utility methods for testing.
114
120
  * Extends @faker-js/faker with custom methods for common test data generation patterns.
@@ -135,6 +141,10 @@ declare const faker: Readonly<_faker_js_faker4.Faker & {
135
141
  resetSequence: typeof resetSequence;
136
142
  resetAllSequences: typeof resetAllSequences;
137
143
  price: typeof price;
144
+ coordinates: {
145
+ within: typeof coordinateInRadius;
146
+ outside: typeof coordinateOutsideRadius;
147
+ };
138
148
  }>;
139
149
  /**
140
150
  * Type definition for timestamp fields.
@@ -152,4 +162,4 @@ type Timestamps = {
152
162
  */
153
163
  type FakerFactory = typeof faker;
154
164
  //#endregion
155
- export { FakerFactory, Timestamps, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
165
+ export { FakerFactory, Timestamps, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
package/dist/faker.cjs CHANGED
@@ -1,5 +1,6 @@
1
- const require_faker = require('./faker-SMN4ira4.cjs');
1
+ const require_faker = require('./faker-B14IEMIN.cjs');
2
2
 
3
+ exports.coordinateInRadius = require_faker.coordinateInRadius;
3
4
  exports.faker = require_faker.faker;
4
5
  exports.identifier = require_faker.identifier;
5
6
  exports.resetAllSequences = require_faker.resetAllSequences;
package/dist/faker.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { FakerFactory, Timestamps, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-DAiFK3T3.cjs";
2
- export { FakerFactory, Timestamps, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
1
+ import { FakerFactory, Timestamps, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-km9UhOS6.cjs";
2
+ export { FakerFactory, Timestamps, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
package/dist/faker.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { FakerFactory, Timestamps, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-nN9Ki6fn.mjs";
2
- export { FakerFactory, Timestamps, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
1
+ import { FakerFactory, Timestamps, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-ChuHaYMR.mjs";
2
+ export { FakerFactory, Timestamps, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
package/dist/faker.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-CxKkEeYi.mjs";
1
+ import { coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-BGKYFoCT.mjs";
2
2
 
3
- export { faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
3
+ export { coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
package/dist/kysely.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  require('./Factory-WMhTNZ9S.cjs');
2
- require('./faker-SMN4ira4.cjs');
3
- const require_KyselyFactory = require('./KyselyFactory-Bdq1s1Go.cjs');
2
+ require('./faker-B14IEMIN.cjs');
3
+ const require_KyselyFactory = require('./KyselyFactory-CXtfmMfK.cjs');
4
4
  require('./PostgresMigrator-DFcNdCvD.cjs');
5
5
  const require_PostgresKyselyMigrator = require('./PostgresKyselyMigrator-CfytARcA.cjs');
6
6
  const require_VitestTransactionIsolator = require('./VitestTransactionIsolator-CruLTRRi.cjs');
package/dist/kysely.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import "./faker-DAiFK3T3.cjs";
2
- import "./Factory-B9LP1L18.cjs";
3
- import { KyselyFactory } from "./KyselyFactory-CrLWxJW4.cjs";
1
+ import "./faker-km9UhOS6.cjs";
2
+ import "./Factory-Bm44VKa-.cjs";
3
+ import { KyselyFactory } from "./KyselyFactory-BoPDDitt.cjs";
4
4
  import "./PostgresMigrator-D5UkK1_K.cjs";
5
5
  import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-CQ3aUoy_.cjs";
6
6
  import { IsolationLevel } from "./VitestTransactionIsolator-DHf2MxmC.cjs";
package/dist/kysely.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import "./faker-nN9Ki6fn.mjs";
2
- import "./Factory-DiZSNxC0.mjs";
3
- import { KyselyFactory } from "./KyselyFactory-B-zlLbov.mjs";
1
+ import "./faker-ChuHaYMR.mjs";
2
+ import "./Factory-tjCDNgUK.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-D82j74t9.mjs";
4
4
  import "./PostgresMigrator-BlvuQl7d.mjs";
5
5
  import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-_6yHZigp.mjs";
6
6
  import { IsolationLevel } from "./VitestTransactionIsolator-Xqyjlmw6.mjs";
package/dist/kysely.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./Factory-z2m01hMj.mjs";
2
- import "./faker-CxKkEeYi.mjs";
3
- import { KyselyFactory } from "./KyselyFactory-ELiHgHVv.mjs";
2
+ import "./faker-BGKYFoCT.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-C3Bc3p4L.mjs";
4
4
  import "./PostgresMigrator-DxPC_gGu.mjs";
5
5
  import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-Bdhl251C.mjs";
6
6
  import { IsolationLevel } from "./VitestTransactionIsolator-BWwK-ca6.mjs";
@@ -1,6 +1,6 @@
1
1
  require('./Factory-WMhTNZ9S.cjs');
2
- require('./faker-SMN4ira4.cjs');
3
- const require_ObjectionFactory = require('./ObjectionFactory-Wq80ypMM.cjs');
2
+ require('./faker-B14IEMIN.cjs');
3
+ const require_ObjectionFactory = require('./ObjectionFactory-DxIxJagq.cjs');
4
4
  require('./PostgresMigrator-DFcNdCvD.cjs');
5
5
  const require_PostgresObjectionMigrator = require('./PostgresObjectionMigrator-BG6ymgnt.cjs');
6
6
  const require_VitestTransactionIsolator = require('./VitestTransactionIsolator-CruLTRRi.cjs');
@@ -1,6 +1,6 @@
1
- import "./faker-DAiFK3T3.cjs";
2
- import "./Factory-B9LP1L18.cjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-vME-wNlq.cjs";
1
+ import "./faker-km9UhOS6.cjs";
2
+ import "./Factory-Bm44VKa-.cjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-BWMTXsxH.cjs";
4
4
  import "./PostgresMigrator-D5UkK1_K.cjs";
5
5
  import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-CZHHcCOv.cjs";
6
6
  import { IsolationLevel } from "./VitestTransactionIsolator-DHf2MxmC.cjs";
@@ -1,6 +1,6 @@
1
- import "./faker-nN9Ki6fn.mjs";
2
- import "./Factory-DiZSNxC0.mjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-CJCpvwts.mjs";
1
+ import "./faker-ChuHaYMR.mjs";
2
+ import "./Factory-tjCDNgUK.mjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-CEG5qUrm.mjs";
4
4
  import "./PostgresMigrator-BlvuQl7d.mjs";
5
5
  import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-C69n7vzr.mjs";
6
6
  import { IsolationLevel } from "./VitestTransactionIsolator-Xqyjlmw6.mjs";
@@ -1,6 +1,6 @@
1
1
  import "./Factory-z2m01hMj.mjs";
2
- import "./faker-CxKkEeYi.mjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-aqM0dDW7.mjs";
2
+ import "./faker-BGKYFoCT.mjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-qIICOph3.mjs";
4
4
  import "./PostgresMigrator-DxPC_gGu.mjs";
5
5
  import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-G4h5FLvU.mjs";
6
6
  import { IsolationLevel } from "./VitestTransactionIsolator-BWwK-ca6.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/testkit",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
package/src/faker.ts CHANGED
@@ -215,6 +215,88 @@ function price(): number {
215
215
  return +faker.commerce.price();
216
216
  }
217
217
 
218
+ type Coordinate = {
219
+ lat: number;
220
+ lng: number;
221
+ };
222
+
223
+ export function coordinateInRadius(
224
+ center: Coordinate,
225
+ radius: number,
226
+ ): Coordinate {
227
+ // Earth's radius in meters
228
+ const earth = 6378137;
229
+ // Convert radius from meters to degrees
230
+ const d = radius / earth;
231
+
232
+ // Random bearing and distance
233
+ const theta = 2 * Math.PI * Math.random();
234
+ const r = d * Math.sqrt(Math.random());
235
+
236
+ const lat1 = (center.lat * Math.PI) / 180;
237
+ const lng1 = (center.lng * Math.PI) / 180;
238
+
239
+ const lat2 = Math.asin(
240
+ Math.sin(lat1) * Math.cos(r) +
241
+ Math.cos(lat1) * Math.sin(r) * Math.cos(theta),
242
+ );
243
+ const lng2 =
244
+ lng1 +
245
+ Math.atan2(
246
+ Math.sin(theta) * Math.sin(r) * Math.cos(lat1),
247
+ Math.cos(r) - Math.sin(lat1) * Math.sin(lat2),
248
+ );
249
+
250
+ return {
251
+ lat: (lat2 * 180) / Math.PI,
252
+ lng: (lng2 * 180) / Math.PI,
253
+ };
254
+ }
255
+
256
+ function coordinateOutsideRadius(
257
+ center: Coordinate,
258
+ minRadiusMeters: number,
259
+ maxRadiusMeters: number,
260
+ ): Coordinate {
261
+ // Earth's radius in meters
262
+ const earth = 6378137;
263
+
264
+ // Convert radii from meters to radians
265
+ const minD = minRadiusMeters / earth;
266
+ const maxD = maxRadiusMeters / earth;
267
+
268
+ // Random bearing
269
+ const theta = 2 * Math.PI * Math.random();
270
+
271
+ // Random distance in annular ring (uniform distribution by area)
272
+ // For uniform distribution in annulus: r = sqrt(r_min² + (r_max² - r_min²) * random)
273
+ const r = Math.sqrt(
274
+ minD * minD + (maxD * maxD - minD * minD) * Math.random(),
275
+ );
276
+
277
+ const lat1 = (center.lat * Math.PI) / 180;
278
+ const lng1 = (center.lng * Math.PI) / 180;
279
+
280
+ const lat2 = Math.asin(
281
+ Math.sin(lat1) * Math.cos(r) +
282
+ Math.cos(lat1) * Math.sin(r) * Math.cos(theta),
283
+ );
284
+ const lng2 =
285
+ lng1 +
286
+ Math.atan2(
287
+ Math.sin(theta) * Math.sin(r) * Math.cos(lat1),
288
+ Math.cos(r) - Math.sin(lat1) * Math.sin(lat2),
289
+ );
290
+
291
+ // Normalize longitude to [-180, 180]
292
+ const normalizedLng = (((lng2 * 180) / Math.PI + 540) % 360) - 180;
293
+
294
+ return {
295
+ lat: (lat2 * 180) / Math.PI,
296
+ lng: normalizedLng,
297
+ };
298
+ }
299
+
218
300
  /**
219
301
  * Enhanced faker instance with additional utility methods for testing.
220
302
  * Extends @faker-js/faker with custom methods for common test data generation patterns.
@@ -242,6 +324,10 @@ export const faker = Object.freeze(
242
324
  resetSequence,
243
325
  resetAllSequences,
244
326
  price,
327
+ coordinates: {
328
+ within: coordinateInRadius,
329
+ outside: coordinateOutsideRadius,
330
+ },
245
331
  }),
246
332
  );
247
333