Merge branch 'develop' of github.com:Budibase/budibase into cheeks-lab-day-grid

This commit is contained in:
Andrew Kingston 2022-10-20 19:49:34 +01:00
commit fe631a251a
19 changed files with 179 additions and 91 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Budibase backend core libraries used in server and worker", "description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
@ -20,7 +20,7 @@
"test:watch": "jest --watchAll" "test:watch": "jest --watchAll"
}, },
"dependencies": { "dependencies": {
"@budibase/types": "2.0.30-alpha.7", "@budibase/types": "2.0.30-alpha.8",
"@shopify/jest-koa-mocks": "5.0.1", "@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0", "aws-sdk": "2.1030.0",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/bbui", "name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.", "description": "A UI solution used in the different Budibase projects.",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",
@ -38,7 +38,7 @@
], ],
"dependencies": { "dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.2.1", "@adobe/spectrum-css-workflow-icons": "^1.2.1",
"@budibase/string-templates": "2.0.30-alpha.7", "@budibase/string-templates": "2.0.30-alpha.8",
"@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2", "@spectrum-css/avatar": "^3.0.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -71,10 +71,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.0.30-alpha.7", "@budibase/bbui": "2.0.30-alpha.8",
"@budibase/client": "2.0.30-alpha.7", "@budibase/client": "2.0.30-alpha.8",
"@budibase/frontend-core": "2.0.30-alpha.7", "@budibase/frontend-core": "2.0.30-alpha.8",
"@budibase/string-templates": "2.0.30-alpha.7", "@budibase/string-templates": "2.0.30-alpha.8",
"@sentry/browser": "5.19.1", "@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js", "main": "src/index.js",
"bin": { "bin": {
@ -26,9 +26,9 @@
"outputPath": "build" "outputPath": "build"
}, },
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.0.30-alpha.7", "@budibase/backend-core": "2.0.30-alpha.8",
"@budibase/string-templates": "2.0.30-alpha.7", "@budibase/string-templates": "2.0.30-alpha.8",
"@budibase/types": "2.0.30-alpha.7", "@budibase/types": "2.0.30-alpha.8",
"axios": "0.21.2", "axios": "0.21.2",
"chalk": "4.1.0", "chalk": "4.1.0",
"cli-progress": "3.11.2", "cli-progress": "3.11.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.0.30-alpha.7", "@budibase/bbui": "2.0.30-alpha.8",
"@budibase/frontend-core": "2.0.30-alpha.7", "@budibase/frontend-core": "2.0.30-alpha.8",
"@budibase/string-templates": "2.0.30-alpha.7", "@budibase/string-templates": "2.0.30-alpha.8",
"@spectrum-css/button": "^3.0.3", "@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3", "@spectrum-css/divider": "^1.0.3",

View File

@ -1,12 +1,12 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Budibase frontend core libraries used in builder and client", "description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"dependencies": { "dependencies": {
"@budibase/bbui": "2.0.30-alpha.7", "@budibase/bbui": "2.0.30-alpha.8",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"svelte": "^3.46.2" "svelte": "^3.46.2"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/sdk", "name": "@budibase/sdk",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Budibase Public API SDK", "description": "Budibase Public API SDK",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -77,11 +77,11 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "10.0.3", "@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.0.30-alpha.7", "@budibase/backend-core": "2.0.30-alpha.8",
"@budibase/client": "2.0.30-alpha.7", "@budibase/client": "2.0.30-alpha.8",
"@budibase/pro": "2.0.30-alpha.7", "@budibase/pro": "2.0.30-alpha.8",
"@budibase/string-templates": "2.0.30-alpha.7", "@budibase/string-templates": "2.0.30-alpha.8",
"@budibase/types": "2.0.30-alpha.7", "@budibase/types": "2.0.30-alpha.8",
"@bull-board/api": "3.7.0", "@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4", "@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",

View File

@ -1094,12 +1094,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.0.30-alpha.7": "@budibase/backend-core@2.0.30-alpha.8":
version "2.0.30-alpha.7" version "2.0.30-alpha.8"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.7.tgz#a46ddcda96c6ecead6574cb0e2751e4ed858371d" resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.8.tgz#2eef65f40c3859c96268f0c709c57bb225cf7ca3"
integrity sha512-aX41o4QE7OlS+JeKIDt3bJGGsbddI4eRAram+2bYlHONbupkbTAVs9DFBkV9BkMCQ8zk9FSDY90Le0GEuiI+sw== integrity sha512-ZjoTLoNeLaU7+YNltOS9tG7/GNR22iyR8O8TCXyqK0u1fyL/MFLp8Cj3Epv7JBfBkLtVg9ah8ACPK/kCNemahQ==
dependencies: dependencies:
"@budibase/types" "2.0.30-alpha.7" "@budibase/types" "2.0.30-alpha.8"
"@shopify/jest-koa-mocks" "5.0.1" "@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2" "@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0" aws-sdk "2.1030.0"
@ -1180,13 +1180,13 @@
svelte-flatpickr "^3.2.3" svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0" svelte-portal "^1.0.0"
"@budibase/pro@2.0.30-alpha.7": "@budibase/pro@2.0.30-alpha.8":
version "2.0.30-alpha.7" version "2.0.30-alpha.8"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.7.tgz#1432b47141b305666dc005c5fc5a02d9cd38cf6a" resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.8.tgz#1bcab899326e04607a74112482ff2ffca3776cf1"
integrity sha512-F8qkj+Uy2Pqi/FeJYDBEdNAT7zEx/dw19x8o+3vHmTnQhwLbuSOHGyy9C6PgSW5Gmm0GgxjOycDVOq7ewnwWDA== integrity sha512-QhfTZn5oaJIPSUYFTnShgqADXeikVi4xbsOJGhGR2Ysl/7DlTRse9JVhql6OpRO9ozbab6tSJ2NxIJFgznsvhQ==
dependencies: dependencies:
"@budibase/backend-core" "2.0.30-alpha.7" "@budibase/backend-core" "2.0.30-alpha.8"
"@budibase/types" "2.0.30-alpha.7" "@budibase/types" "2.0.30-alpha.8"
"@koa/router" "8.0.8" "@koa/router" "8.0.8"
joi "17.6.0" joi "17.6.0"
node-fetch "^2.6.1" node-fetch "^2.6.1"
@ -1209,10 +1209,10 @@
svelte-apexcharts "^1.0.2" svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0" svelte-flatpickr "^3.1.0"
"@budibase/types@2.0.30-alpha.7": "@budibase/types@2.0.30-alpha.8":
version "2.0.30-alpha.7" version "2.0.30-alpha.8"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.7.tgz#fe85563eb42ce01869e653a790a7f213ea2d6308" resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.8.tgz#36fb30fcb121904754369e4312892a34bdff63cd"
integrity sha512-WL+2LPQyYq1BwPGgkM7wRnIv4/QXMX1ivXpzoy9lzi1yCJw0rxg8MBpfUuVU0cmDOAnmHkTh2nBQNUhLYPyvVA== integrity sha512-I5+W+JU95jSRGhN7dvmdiQPyAHa+OUttc4WYYAkE6MYlaraOZd9aVF4IcY9aQR6cZWZ1GZIxoGPJPoNjU3tDLQ==
"@bull-board/api@3.7.0": "@bull-board/api@3.7.0":
version "3.7.0" version "3.7.0"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/types", "name": "@budibase/types",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Budibase types", "description": "Budibase types",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.0.30-alpha.7", "version": "2.0.30-alpha.8",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -36,10 +36,10 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.0.30-alpha.7", "@budibase/backend-core": "2.0.30-alpha.8",
"@budibase/pro": "2.0.30-alpha.7", "@budibase/pro": "2.0.30-alpha.8",
"@budibase/string-templates": "2.0.30-alpha.7", "@budibase/string-templates": "2.0.30-alpha.8",
"@budibase/types": "2.0.30-alpha.7", "@budibase/types": "2.0.30-alpha.8",
"@koa/router": "8.0.8", "@koa/router": "8.0.8",
"@sentry/node": "6.17.7", "@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",

View File

@ -291,12 +291,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.0.30-alpha.7": "@budibase/backend-core@2.0.30-alpha.8":
version "2.0.30-alpha.7" version "2.0.30-alpha.8"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.7.tgz#a46ddcda96c6ecead6574cb0e2751e4ed858371d" resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.30-alpha.8.tgz#2eef65f40c3859c96268f0c709c57bb225cf7ca3"
integrity sha512-aX41o4QE7OlS+JeKIDt3bJGGsbddI4eRAram+2bYlHONbupkbTAVs9DFBkV9BkMCQ8zk9FSDY90Le0GEuiI+sw== integrity sha512-ZjoTLoNeLaU7+YNltOS9tG7/GNR22iyR8O8TCXyqK0u1fyL/MFLp8Cj3Epv7JBfBkLtVg9ah8ACPK/kCNemahQ==
dependencies: dependencies:
"@budibase/types" "2.0.30-alpha.7" "@budibase/types" "2.0.30-alpha.8"
"@shopify/jest-koa-mocks" "5.0.1" "@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2" "@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0" aws-sdk "2.1030.0"
@ -327,21 +327,21 @@
uuid "8.3.2" uuid "8.3.2"
zlib "1.0.5" zlib "1.0.5"
"@budibase/pro@2.0.30-alpha.7": "@budibase/pro@2.0.30-alpha.8":
version "2.0.30-alpha.7" version "2.0.30-alpha.8"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.7.tgz#1432b47141b305666dc005c5fc5a02d9cd38cf6a" resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.30-alpha.8.tgz#1bcab899326e04607a74112482ff2ffca3776cf1"
integrity sha512-F8qkj+Uy2Pqi/FeJYDBEdNAT7zEx/dw19x8o+3vHmTnQhwLbuSOHGyy9C6PgSW5Gmm0GgxjOycDVOq7ewnwWDA== integrity sha512-QhfTZn5oaJIPSUYFTnShgqADXeikVi4xbsOJGhGR2Ysl/7DlTRse9JVhql6OpRO9ozbab6tSJ2NxIJFgznsvhQ==
dependencies: dependencies:
"@budibase/backend-core" "2.0.30-alpha.7" "@budibase/backend-core" "2.0.30-alpha.8"
"@budibase/types" "2.0.30-alpha.7" "@budibase/types" "2.0.30-alpha.8"
"@koa/router" "8.0.8" "@koa/router" "8.0.8"
joi "17.6.0" joi "17.6.0"
node-fetch "^2.6.1" node-fetch "^2.6.1"
"@budibase/types@2.0.30-alpha.7": "@budibase/types@2.0.30-alpha.8":
version "2.0.30-alpha.7" version "2.0.30-alpha.8"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.7.tgz#fe85563eb42ce01869e653a790a7f213ea2d6308" resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.30-alpha.8.tgz#36fb30fcb121904754369e4312892a34bdff63cd"
integrity sha512-WL+2LPQyYq1BwPGgkM7wRnIv4/QXMX1ivXpzoy9lzi1yCJw0rxg8MBpfUuVU0cmDOAnmHkTh2nBQNUhLYPyvVA== integrity sha512-I5+W+JU95jSRGhN7dvmdiQPyAHa+OUttc4WYYAkE6MYlaraOZd9aVF4IcY9aQR6cZWZ1GZIxoGPJPoNjU3tDLQ==
"@cspotcode/source-map-consumer@0.8.0": "@cspotcode/source-map-consumer@0.8.0":
version "0.8.0" version "0.8.0"

View File

@ -1,15 +1,18 @@
import ApplicationApi from "./applications" import ApplicationApi from "./applications"
import AuthApi from "./auth" import AuthApi from "./auth"
import InternalAPIClient from "./InternalAPIClient" import InternalAPIClient from "./InternalAPIClient"
import ScreenApi from "./screens"
export default class TestConfiguration<T> { export default class TestConfiguration<T> {
applications: ApplicationApi applications: ApplicationApi
auth: AuthApi auth: AuthApi
screen: ScreenApi
context: T context: T
constructor(apiClient: InternalAPIClient) { constructor(apiClient: InternalAPIClient) {
this.applications = new ApplicationApi(apiClient) this.applications = new ApplicationApi(apiClient)
this.auth = new AuthApi(apiClient) this.auth = new AuthApi(apiClient)
this.screen = new ScreenApi(apiClient)
this.context = <T>{} this.context = <T>{}
} }

View File

@ -0,0 +1,23 @@
import { Screen } from "@budibase/types"
import { Response } from "node-fetch"
import InternalAPIClient from "./InternalAPIClient"
export default class ScreenApi {
api: InternalAPIClient
constructor(apiClient: InternalAPIClient) {
this.api = apiClient
}
async create(body: any): Promise<[Response, Screen]> {
const response = await this.api.post(`/screens`, { body })
const json = await response.json()
return [response, json]
}
async delete(screenId: string, rev: string): Promise<[Response, Screen]> {
const response = await this.api.del(`/screens/${screenId}/${rev}`)
const json = await response.json()
return [response, json]
}
}

View File

@ -2,17 +2,20 @@ import generator from "../../generator"
const randomId = generator.guid() const randomId = generator.guid()
const generateScreen = (): any => ({ const generateScreen = (roleId: string): any => ({
showNavigation: true, showNavigation: true,
width: "Large", width: "Large",
name: randomId,
template: "createFromScratch",
props: { props: {
_id: randomId, _id: randomId,
_component: "@budibase/standard-components/container", _component:
"@budibase/standard-components/container",
_styles: { _styles: {
normal: {}, normal: {},
hover: {}, hover: {},
active: {}, active: {},
selected: {}, selected: {}
}, },
_children: [], _children: [],
_instanceName: "New Screen", _instanceName: "New Screen",
@ -20,15 +23,12 @@ const generateScreen = (): any => ({
hAlign: "stretch", hAlign: "stretch",
vAlign: "top", vAlign: "top",
size: "grow", size: "grow",
gap: "M", gap: "M"
}, }, routing: {
routing: {
route: "/test", route: "/test",
roleId: "BASIC", roleId: roleId,
homeScreen: false, homeScreen: false
}, },
name: randomId,
template: "createFromScratch",
}) })
export default generateScreen export default generateScreen

View File

@ -164,7 +164,7 @@ describe("Internal API - /applications endpoints", () => {
// Change/add component to the app // Change/add component to the app
const [screenResponse, screen] = await config.applications.addScreentoApp( const [screenResponse, screen] = await config.applications.addScreentoApp(
generateScreen() generateScreen("BASIC")
) )
expect(screenResponse).toHaveStatusCode(200) expect(screenResponse).toHaveStatusCode(200)
expect(screen._id).toBeDefined() expect(screen._id).toBeDefined()

View File

@ -0,0 +1,62 @@
import TestConfiguration from "../../../config/internal-api/TestConfiguration"
import { App } from "@budibase/types"
import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
import generateApp from "../../../config/internal-api/fixtures/applications"
import { Screen } from "@budibase/types"
import generateScreen from "../../../config/internal-api/fixtures/screens"
describe("Internal API - /screens endpoints", () => {
const api = new InternalAPIClient()
const config = new TestConfiguration<Screen>(api)
const appConfig = new TestConfiguration<App>(api)
beforeAll(async () => {
await config.beforeAll()
})
afterAll(async () => {
await config.afterAll()
})
it("POST - Create a screen with each role type", async () => {
// Create app
const [appResponse, 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]))
expect(response).toHaveStatusCode(200)
expect(screen.routing.roleId).toEqual(roleArray[role])
}
})
it("GET - Fetch screens", async () => {
// Create app
const [appResponse, app] = await appConfig.applications.create(generateApp())
// Create Screen
appConfig.applications.api.appId = app.appId
const [response, screen] = await config.screen.create(generateScreen("BASIC"))
// Check screen exists
const [routesResponse, routes] = await appConfig.applications.getRoutes()
expect(routesResponse).toHaveStatusCode(200)
expect(routes.routes["/test"]).toBeTruthy()
})
it("DELETE - Delete a screen", async () => {
// Create app
const [appResponse, app] = await appConfig.applications.create(generateApp())
// Create Screen
appConfig.applications.api.appId = app.appId
const [screenResponse, screen] = await config.screen.create(generateScreen("BASIC"))
// Delete Screen
const [response] = await config.screen.delete(screen._id!, screen._rev!)
expect(response).toHaveStatusCode(200)
})
})