Update commands to run locally and in CI

This commit is contained in:
Pedro Silva 2023-03-26 18:00:20 +01:00
parent 05ba08a956
commit 46381c381d
2 changed files with 40 additions and 2 deletions

View File

@ -13,13 +13,15 @@
"test:watch": "env-cmd jest --watch",
"test:debug": "DEBUG=1 jest",
"test:notify": "node scripts/testResultsWebhook",
"test:ci": "jest --runInBand --json --outputFile=testResults.json",
"test:ci": "jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"",
"docker:up": "docker-compose up -d",
"docker:down": "docker-compose down",
"api:server:setup": "npm run docker:up && env-cmd ts-node ../packages/builder/ts/setup.ts",
"api:server:setup:ci": "env-cmd node ../packages/builder/setup.js",
"api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test",
"api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test"
"api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test",
"api:test:local": "env-cmd jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"",
"api:test:local:withDataSources": "env-cmd jest --runInBand"
},
"jest": {
"preset": "ts-jest",

View File

@ -0,0 +1,36 @@
import TestConfiguration from "../../../config/internal-api/TestConfiguration"
import { App } from "@budibase/types"
import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient"
import { generateApp } from "../../../config/internal-api/fixtures/applications"
import { Screen } from "@budibase/types"
import generateScreen from "../../../config/internal-api/fixtures/screens"
describe("Internal API - Data Sources", () => {
const api = new InternalAPIClient()
const accountsAPI = new AccountsAPIClient()
const config = new TestConfiguration<Screen>(api, accountsAPI)
const appConfig = new TestConfiguration<App>(api, accountsAPI)
beforeAll(async () => {
await config.setupAccountAndTenant()
})
afterAll(async () => {
await config.afterAll()
})
it("Create an app with a data source", async () => {
// Create app
const app = await appConfig.applications.create(generateApp())
// Create Screen
const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"]
appConfig.applications.api.appId = app.appId
for (let role in roleArray) {
const [response, screen] = await config.screen.create(
generateScreen(roleArray[role])
)
}
})
})