Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
arpowers committed Feb 8, 2022
1 parent 51faefc commit c892043
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 181 deletions.
2 changes: 1 addition & 1 deletion @apps/factor-site/package.json
Expand Up @@ -43,6 +43,6 @@
"devDependencies": {
"@tailwindcss/forms": "^0.4.0",
"execa": "^6.0.0",
"vitest": "^0.2.0"
"vitest": "0.2.7"
}
}
20 changes: 9 additions & 11 deletions @apps/factor-site/test/site.test.ts
@@ -1,15 +1,13 @@
import { expect, it, describe } from "vitest"
import { expect, test, describe } from "vitest"
import { execaCommandSync } from "execa"

describe("factor site", () => {
it("builds", () => {
const r = execaCommandSync(
"npm exec -w @factor/site -- factor prerender --port 3434",
{
env: { TEST_ENV: "unit" },
},
)
test("builds", () => {
const r = execaCommandSync(
"npm exec -w @factor/site -- factor prerender --port 3434",
{
env: { TEST_ENV: "unit" },
},
)

expect(r.stdout).toContain("built successfully")
})
expect(r.stdout).toContain("built successfully")
})
2 changes: 1 addition & 1 deletion @core/build/release.ts
Expand Up @@ -8,7 +8,7 @@ import { logger } from "@factor/api/logger"
import { isGitDirty, getPackages } from "./utils"
import { createRequire } from "module"
import { PackageJson } from "@factor/types"
import { CliOptions } from "@factor/cli/program"
import type { CliOptions } from "@factor/cli/program"

const require = createRequire(import.meta.url)

Expand Down
3 changes: 2 additions & 1 deletion @core/engine/email.ts
Expand Up @@ -13,7 +13,8 @@ const getFromAddress = (): string => {

if (!name || !email) {
throw _stop({
message: "can't send email. name or email are not available",
message:
"node email misconfigured: (FACTOR_APP_NAME or FACTOR_APP_EMAIL)",
})
}

Expand Down
2 changes: 1 addition & 1 deletion @core/engine/package.json
Expand Up @@ -41,6 +41,6 @@
"serve-static": "^1.14.1"
},
"devDependencies": {
"vitest": "^0.2.0"
"vitest": "0.2.7"
}
}
2 changes: 1 addition & 1 deletion @core/engine/test/user.test.ts
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
import { expect, it, vi, describe } from "vitest"
import { Queries } from "../user"
import { FullUser } from "@factor/types"
Expand Down Expand Up @@ -76,6 +75,7 @@ describe("user tests", () => {
})

it("resets password", async () => {
if (!user.email) throw new Error("email required")
const response = await ep.Queries.ResetPassword.serve(
{
email: user.email,
Expand Down
2 changes: 1 addition & 1 deletion @core/render/index.ts
@@ -1,4 +1,4 @@
import { CliOptions } from "@factor/cli/program"
import type { CliOptions } from "@factor/cli/program"

import { serveApp } from "./serve"

Expand Down
2 changes: 1 addition & 1 deletion @core/server/package.json
Expand Up @@ -14,6 +14,6 @@
"body-parser": "^1.19.0"
},
"devDependencies": {
"vitest": "^0.2.0"
"vitest": "0.2.7"
}
}
2 changes: 1 addition & 1 deletion @core/test/package.json
Expand Up @@ -12,6 +12,6 @@
"@factor/render": "4.0.14",
"@factor/server": "4.0.14",
"vite": "^2.7.12",
"vitest": "^0.2.0"
"vitest": "0.2.7"
}
}
19 changes: 8 additions & 11 deletions @core/test/setupTest.ts
@@ -1,18 +1,15 @@
import { beforeEach } from "vitest"
import { importServerEntry } from "@factor/engine/nodeUtils"
import { setupEnvironment } from "@factor/server"
process.env.POSTGRES_URL = "http://test:test@localhost:5432/test"
process.env.POSTGRES_PASSWORD = "test"
process.env.TEST_ENV = "unit"

beforeEach(async () => {
const serverConfig = await importServerEntry("@factor/site")
await setupEnvironment({
variables: {
FACTOR_APP_NAME: "FactorJS",
FACTOR_APP_EMAIL: "hi@factorjs.org",
FACTOR_APP_URL: "https://www.factorjs.org",
},
...serverConfig,
})
const serverConfig = await importServerEntry("@factor/site")
await setupEnvironment({
variables: {
FACTOR_APP_NAME: "FactorJS",
FACTOR_APP_EMAIL: "hi@factorjs.org",
FACTOR_APP_URL: "https://www.factorjs.org",
},
...serverConfig,
})
2 changes: 1 addition & 1 deletion @plugins/plugin-stripe/package.json
Expand Up @@ -17,6 +17,6 @@
},
"devDependencies": {
"dotenv": "^16.0.0",
"vitest": "^0.2.0"
"vitest": "0.2.7"
}
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -20,10 +20,10 @@
},
"license": "MIT",
"workspaces": [
"@core/*",
"@engine/*",
"@apps/*",
"@plugins/*",
"@core/*",
"@engine/*",
"@test/*",
"cdk"
],
Expand Down

0 comments on commit c892043

Please sign in to comment.