Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b54e58c99a |
No files matched your search
@@ -1,35 +0,0 @@
|
||||
name: Mutation Testing
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
stryker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Required for incremental mutation testing
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Run Stryker Mutation Testing (Incremental)
|
||||
run: pnpm exec stryker run
|
||||
+1
-2
@@ -55,8 +55,6 @@
|
||||
"zustand": "^5.0.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@stryker-mutator/core": "^9.6.1",
|
||||
"@stryker-mutator/vitest-runner": "^9.6.1",
|
||||
"@testing-library/dom": "^10.4.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@types/bcryptjs": "^3.0.0",
|
||||
@@ -71,6 +69,7 @@
|
||||
"copy-webpack-plugin": "^14.0.0",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "^16.2.6",
|
||||
"fast-check": "^4.8.0",
|
||||
"jsdom": "^28.1.0",
|
||||
"rollup-plugin-external-globals": "^0.13.0",
|
||||
"tsx": "^4.21.0",
|
||||
|
||||
Generated
+943
-809
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,6 @@
|
||||
import { describe, test, expect } from "vitest";
|
||||
import { normalizeToGeoJson } from "./normalizer";
|
||||
import fc from "fast-check";
|
||||
|
||||
describe("normalizeToGeoJson", () => {
|
||||
test("passes through a valid FeatureCollection", () => {
|
||||
@@ -161,4 +162,37 @@ describe("normalizeToGeoJson", () => {
|
||||
test("throws on unrecognized format", () => {
|
||||
expect(() => normalizeToGeoJson({ foo: "bar" })).toThrow("Unrecognized");
|
||||
});
|
||||
|
||||
test("property: handles random coordinate inputs autonomously", () => {
|
||||
// This property test autonomously generates random float pairs to test edge-cases
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.float({ noDefaultInfinity: true, noNaN: true }),
|
||||
fc.float({ noDefaultInfinity: true, noNaN: true }),
|
||||
(lon, lat) => {
|
||||
const input = {
|
||||
type: "Feature",
|
||||
geometry: { type: "Point", coordinates: [lon, lat] },
|
||||
properties: {},
|
||||
};
|
||||
|
||||
try {
|
||||
const result = normalizeToGeoJson(input);
|
||||
// normalizer skips coordinates outside valid bounds [-180, 180], [-90, 90]
|
||||
if (lon < -180 || lon > 180 || lat < -90 || lat > 90) {
|
||||
expect(result.skippedCount).toBe(1);
|
||||
} else {
|
||||
expect(result.skippedCount).toBe(0);
|
||||
expect(result.collection.features[0].geometry.coordinates).toEqual([lon, lat]);
|
||||
}
|
||||
} catch (e: any) {
|
||||
// Normalizer explicitly throws if ALL features are skipped
|
||||
if (e.message !== "No features with valid geometry found.") {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
|
||||
"packageManager": "pnpm",
|
||||
"testRunner": "vitest",
|
||||
"plugins": [
|
||||
"@stryker-mutator/vitest-runner"
|
||||
],
|
||||
"vitest": {
|
||||
"configFile": "vitest.config.ts"
|
||||
},
|
||||
"reporters": [
|
||||
"html",
|
||||
"clear-text",
|
||||
"progress"
|
||||
],
|
||||
"coverageAnalysis": "perTest",
|
||||
"ignoreStatic": true,
|
||||
"mutate": [
|
||||
"src/core/**/*.ts",
|
||||
"src/core/**/*.tsx",
|
||||
"!src/core/**/*.spec.ts",
|
||||
"!src/core/**/*.test.ts"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user