-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from elie222/loading-onboarding-modal
Multi condition supports. Allow smart categories in rules
- Loading branch information
Showing
74 changed files
with
2,922 additions
and
1,330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "22" | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=\"$(pnpm store path --silent)\"" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run tests | ||
run: pnpm -F inbox-zero-ai test | ||
env: | ||
RUN_AI_TESTS: false | ||
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres" | ||
NEXTAUTH_SECRET: "secret" | ||
GOOGLE_CLIENT_ID: "client_id" | ||
GOOGLE_CLIENT_SECRET: "client_secret" | ||
GOOGLE_PUBSUB_TOPIC_NAME: "topic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,12 @@ import { | |
import { defaultCategory } from "@/utils/categories"; | ||
import { aiCategorizeSender } from "@/utils/ai/categorize-sender/ai-categorize-single-sender"; | ||
|
||
// pnpm test-ai ai-categorize-senders | ||
|
||
const isAiTest = process.env.RUN_AI_TESTS === "true"; | ||
|
||
vi.mock("server-only", () => ({})); | ||
|
||
// Test data setup | ||
const testUser = { | ||
email: "[email protected]", | ||
aiProvider: null, | ||
|
@@ -44,7 +47,7 @@ const testSenders = [ | |
}, | ||
]; | ||
|
||
describe("AI Sender Categorization", () => { | ||
describe.skipIf(!isAiTest)("AI Sender Categorization", () => { | ||
describe("Bulk Categorization", () => { | ||
it("should categorize senders with snippets using AI", async () => { | ||
const result = await aiCategorizeSenders({ | ||
|
@@ -125,7 +128,7 @@ describe("AI Sender Categorization", () => { | |
expect(result?.category).toBe(expectedCategory); | ||
} | ||
} | ||
}, 15_000); | ||
}, 30_000); | ||
|
||
it("should handle unknown sender appropriately", async () => { | ||
const unknownSender = testSenders.find( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,16 @@ import { aiGenerateGroupItems } from "@/utils/ai/group/create-group"; | |
import { queryBatchMessages } from "@/utils/gmail/message"; | ||
import type { ParsedMessage } from "@/utils/types"; | ||
|
||
// pnpm test-ai ai-create-group | ||
|
||
const isAiTest = process.env.RUN_AI_TESTS === "true"; | ||
|
||
vi.mock("server-only", () => ({})); | ||
vi.mock("@/utils/gmail/message", () => ({ | ||
queryBatchMessages: vi.fn(), | ||
})); | ||
|
||
describe("aiGenerateGroupItems", () => { | ||
describe.skipIf(!isAiTest)("aiGenerateGroupItems", () => { | ||
it("should generate group items based on user prompt", async () => { | ||
const user = { | ||
email: "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import { describe, it, expect, vi } from "vitest"; | ||
import { aiDiffRules } from "@/utils/ai/rule/diff-rules"; | ||
|
||
// pnpm test-ai ai-diff-rules | ||
|
||
const isAiTest = process.env.RUN_AI_TESTS === "true"; | ||
|
||
vi.mock("server-only", () => ({})); | ||
|
||
describe("aiDiffRules", () => { | ||
describe.skipIf(!isAiTest)("aiDiffRules", () => { | ||
it("should correctly identify added, edited, and removed rules", async () => { | ||
const user = { | ||
email: "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,16 @@ import { queryBatchMessages } from "@/utils/gmail/message"; | |
import type { ParsedMessage } from "@/utils/types"; | ||
import { findExampleMatchesSchema } from "@/utils/ai/example-matches/find-example-matches"; | ||
|
||
// pnpm test-ai ai-find-example-matches | ||
|
||
const isAiTest = process.env.RUN_AI_TESTS === "true"; | ||
|
||
vi.mock("server-only", () => ({})); | ||
vi.mock("@/utils/gmail/message", () => ({ | ||
queryBatchMessages: vi.fn(), | ||
})); | ||
|
||
describe("aiFindExampleMatches", () => { | ||
describe.skipIf(!isAiTest)("aiFindExampleMatches", () => { | ||
it("should find example matches based on user prompt", async () => { | ||
const user = { | ||
email: "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7819ab8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
inbox-zero – ./
inbox-zero-inbox-zero.vercel.app
inbox-zero-git-main-inbox-zero.vercel.app
inbox-zero.vercel.app
www.getinboxzero.com
getinboxzero.com