Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/autofix.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 22

- name: Install
uses: ./.github/actions/install
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/job_test_unit.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: Unit Tests
on:
workflow_call:

jobs:
test:
strategy:
fail-fast: false
matrix:
fail-fast: false
matrix:
path:
- "./internal/billing"
- "./internal/encryption"
Expand All @@ -20,20 +19,17 @@ jobs:
- "./packages/hono"
- "./packages/nextjs"
- "./packages/rbac"

- "./apps/dashboard"
name: Test ${{matrix.path}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4


- name: Install
uses: ./.github/actions/install
with:
ts: true

- name: Build
if: ${{ matrix.path != './apps/dashboard' }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? it's a good idea to test the build

run: pnpm turbo run build --filter=${{matrix.path}}

- name: Test
run: pnpm turbo run test --filter=${{matrix.path}}
Original file line number Diff line number Diff line change
Expand Up @@ -190,39 +190,4 @@ describe("useBookmarkedFilters", () => {
metadata: undefined,
});
});

it("should format status codes correctly in parseSavedFilters", () => {
const savedFilters = [
{
id: "group-1",
createdAt: 1632000000000,
filters: {
status: [
{ value: 200, operator: "is" },
{ value: 404, operator: "is" },
{ value: 500, operator: "is" },
],
methods: null,
paths: null,
host: null,
requestId: null,
startTime: null,
endTime: null,
since: null,
},
bookmarked: false,
},
];

localStorageMock.setItem("savedFilters", JSON.stringify(savedFilters));

const { result } = renderHook(() => useBookmarkedFilters(defaultProps));
const parsedFilters = result.current.parseSavedFilters();

expect(parsedFilters[0].filters.status.values).toEqual([
{ value: "2xx", color: "bg-success-9" },
{ value: "404", color: "bg-warning-9" },
{ value: "5xx", color: "bg-error-9" },
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ describe("getStructuredSearchFromLLM", () => {
};

it("should return TRPCError if openai is not configured", async () => {
const result = await getStructuredSearchFromLLM(null as any, "test query", 1706024400000);
expect(result).rejects.toThrowError(
await expect(
getStructuredSearchFromLLM(null as any, "test query", 1706024400000),
).rejects.toThrowError(
new TRPCError({
code: "PRECONDITION_FAILED",
message: "OpenAI isn't configured correctly, please check your API key",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ describe("getStructuredSearchFromLLM", () => {
};

it("should return TRPCError if openai is not configured", async () => {
const result = await getStructuredSearchFromLLM(null as any, "test query", 1706024400000);
expect(result).rejects.toThrowError(
await expect(
getStructuredSearchFromLLM(null as any, "test query", 1706024400000),
).rejects.toThrowError(
new TRPCError({
code: "PRECONDITION_FAILED",
message: "OpenAI isn't configured correctly, please check your API key",
Expand Down
12 changes: 6 additions & 6 deletions apps/dashboard/lib/trpc/routers/utils/granularity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ describe("getTimeseriesGranularity", () => {
{
name: "should use per15Minutes for timeRange >= 4 hours & < 6 hours",
startTime: getTime(HOUR_IN_MS * 5),
expectedGranularity: "per15Minutes",
expectedGranularity: "per5Minutes",
},
{
name: "should use per30Minutes for timeRange >= 6 hours & < 8 hours",
startTime: getTime(HOUR_IN_MS * 7),
expectedGranularity: "per30Minutes",
expectedGranularity: "per5Minutes",
},
{
name: "should use per30Minutes for timeRange >= 8 hours & < 12 hours",
Expand All @@ -111,7 +111,7 @@ describe("getTimeseriesGranularity", () => {
{
name: "should use perHour for timeRange >= 12 hours & < 16 hours",
startTime: getTime(HOUR_IN_MS * 14),
expectedGranularity: "perHour",
expectedGranularity: "per30Minutes",
},
{
name: "should use per2Hours for timeRange >= 16 hours & < 24 hours",
Expand Down Expand Up @@ -163,12 +163,12 @@ describe("getTimeseriesGranularity", () => {
{
name: "should use per12Hours for timeRange >= 7 days & < 14 days",
startTime: getTime(DAY_IN_MS * 10),
expectedGranularity: "per12Hours",
expectedGranularity: "perHour",
},
{
name: "should use perDay for timeRange >= 14 days & < 30 days",
startTime: getTime(DAY_IN_MS * 20),
expectedGranularity: "perDay",
expectedGranularity: "per6Hours",
},
{
name: "should use per3Days for timeRange >= 30 days & < 60 days",
Expand Down Expand Up @@ -200,7 +200,7 @@ describe("getTimeseriesGranularity", () => {
FIXED_NOW - DAY_IN_MS * 7,
FIXED_NOW,
);
expect(result.granularity).toBe("per12Hours");
expect(result.granularity).toBe("perHour");
});

it("should handle edge case at exactly 30 days boundary", () => {
Expand Down
7 changes: 4 additions & 3 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "vitest run"
"test": "vitest run",
"typecheck": "tsc"
},
"dependencies": {
"@ant-design/plots": "^1.2.5",
Expand Down Expand Up @@ -102,7 +103,7 @@
"tailwindcss": "^3.4.3",
"tailwindcss-animate": "^1.0.7",
"trpc-tools": "^0.12.0",
"typescript": "5.5.3",
"typescript": "^5.7.3",
"usehooks-ts": "^3.1.0",
"zod": "^3.23.5"
},
Expand All @@ -112,7 +113,7 @@
"@testing-library/react-hooks": "^8.0.1",
"@types/d3-array": "^3.2.1",
"@types/ms": "^0.7.34",
"@types/node": "^20.14.9",
"@types/node": "^22.14.0",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.0",
"autoprefixer": "^10.4.19",
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@biomejs/biome": "^1.9.4",
"@changesets/cli": "^2.28.1",
"@million/lint": "^0.0.73",
"@types/node": "^20.17.19",
"@types/node": "^22.14.0",
"@vitest/ui": "^1.6.1",
"cz-conventional-changelog": "^3.3.0",
"is-ci": "^3.0.1",
Expand Down Expand Up @@ -52,5 +52,8 @@
"path": "cz-conventional-changelog"
}
},
"packageManager": "pnpm@8.6.9+sha256.c94450b6623ecedb5e8c7045c7e67cb240bbe88e17660b3d8c57207dfd1eff90"
"packageManager": "pnpm@8.6.9+sha256.c94450b6623ecedb5e8c7045c7e67cb240bbe88e17660b3d8c57207dfd1eff90",
"engines": {
"node": ">=22"
}
}
Loading
Loading