fix server unit tests

This commit is contained in:
Martin McKeaveney 2020-08-19 17:09:30 +01:00
parent 80970ba035
commit 6f71870afd
10 changed files with 58 additions and 30 deletions

View File

@ -10,10 +10,10 @@
<section> <section>
<div class="content"> <div class="content">
<heading> <header>
<i class="ri-information-line alert" /> <i class="ri-information-line alert" />
<h4 class="budibase__title--4">Delete Record</h4> <h4 class="budibase__title--4">Delete Record</h4>
</heading> </header>
<p> <p>
Are you sure you want to delete this record? All of your data will be Are you sure you want to delete this record? All of your data will be
permanently removed. This action cannot be undone. permanently removed. This action cannot be undone.
@ -47,7 +47,7 @@
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
} }
heading { header {
display: flex; display: flex;
align-items: center; align-items: center;
} }

View File

@ -14,10 +14,10 @@
<section> <section>
<div class="content"> <div class="content">
<heading> <header>
<i class="ri-information-line alert" /> <i class="ri-information-line alert" />
<h4 class="budibase__title--4">Delete Table</h4> <h4 class="budibase__title--4">Delete Table</h4>
</heading> </header>
<p> <p>
Are you sure you want to delete this table? All of your data will be Are you sure you want to delete this table? All of your data will be
permanently removed. This action cannot be undone. permanently removed. This action cannot be undone.
@ -50,7 +50,7 @@
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
} }
heading { header {
display: flex; display: flex;
align-items: center; align-items: center;
} }

View File

@ -11,10 +11,10 @@
<section> <section>
<div class="content"> <div class="content">
<heading> <header>
<i class="ri-information-line alert" /> <i class="ri-information-line alert" />
<h4 class="budibase__title--4">Delete View</h4> <h4 class="budibase__title--4">Delete View</h4>
</heading> </header>
<p> <p>
Are you sure you want to delete this view? All of your data will be Are you sure you want to delete this view? All of your data will be
permanently removed. This action cannot be undone. permanently removed. This action cannot be undone.
@ -48,7 +48,7 @@
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
} }
heading { header {
display: flex; display: flex;
align-items: center; align-items: center;
} }

View File

@ -1,5 +1,12 @@
<script> <script>
import { Popover, TextButton, Button, Icon, Input, Select } from "@budibase/bbui" import {
Popover,
TextButton,
Button,
Icon,
Input,
Select,
} from "@budibase/bbui"
import { backendUiStore } from "builderStore" import { backendUiStore } from "builderStore"
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import CreateEditRecord from "../modals/CreateEditRecord.svelte" import CreateEditRecord from "../modals/CreateEditRecord.svelte"

View File

@ -1,6 +1,12 @@
<script> <script>
import { backendUiStore } from "builderStore" import { backendUiStore } from "builderStore"
import { DropdownMenu, TextButton as Button, Icon, Input, Select } from "@budibase/bbui" import {
DropdownMenu,
TextButton as Button,
Icon,
Input,
Select,
} from "@budibase/bbui"
import { FIELDS } from "constants/backend" import { FIELDS } from "constants/backend"
import CreateEditColumn from "../modals/CreateEditColumn.svelte" import CreateEditColumn from "../modals/CreateEditColumn.svelte"

View File

@ -1,5 +1,12 @@
<script> <script>
import { Popover, TextButton, Button, Icon, Input, Select } from "@budibase/bbui" import {
Popover,
TextButton,
Button,
Icon,
Input,
Select,
} from "@budibase/bbui"
import { backendUiStore } from "builderStore" import { backendUiStore } from "builderStore"
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import CreateEditRecord from "../modals/CreateEditRecord.svelte" import CreateEditRecord from "../modals/CreateEditRecord.svelte"
@ -39,7 +46,7 @@
<div class="input-group-row"> <div class="input-group-row">
<p>Group By</p> <p>Group By</p>
<Select secondary thin bind:value={view.groupBy}> <Select secondary thin bind:value={view.groupBy}>
<option value={false}/> <option value={false} />
{#each fields as field} {#each fields as field}
<option value={field}>{field}</option> <option value={field}>{field}</option>
{/each} {/each}

View File

@ -1,5 +1,12 @@
<script> <script>
import { Popover, TextButton, Button, Icon, Input, Select } from "@budibase/bbui" import {
Popover,
TextButton,
Button,
Icon,
Input,
Select,
} from "@budibase/bbui"
import { goto } from "@sveltech/routify" import { goto } from "@sveltech/routify"
import { backendUiStore } from "builderStore" import { backendUiStore } from "builderStore"
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"

View File

@ -6,7 +6,12 @@
export let indented export let indented
</script> </script>
<div data-cy="model-nav-item" class:indented class:selected on:click class={className}> <div
data-cy="model-nav-item"
class:indented
class:selected
on:click
class={className}>
<i class={icon} /> <i class={icon} />
<span>{title}</span> <span>{title}</span>
<slot /> <slot />

View File

@ -65,7 +65,15 @@ describe("/views", () => {
expect(updatedModel.views).toEqual({ expect(updatedModel.views).toEqual({
TestView: { TestView: {
field: "Price", field: "Price",
modelId: model._id modelId: model._id,
schema: {
sum: "number",
min: "number",
max: "number",
count: "number",
sumsqr: "number",
avg: "number"
}
} }
}); });
}) })
@ -108,10 +116,7 @@ describe("/views", () => {
Price: 4000 Price: 4000
}) })
const res = await request const res = await request
.post(`/api/views/query/TestView`) .get(`/api/views/TestView?stats=true`)
.send({
meta: {}
})
.set(defaultHeaders(app._id, instance._id)) .set(defaultHeaders(app._id, instance._id))
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
@ -142,12 +147,7 @@ describe("/views", () => {
Category: "Two" Category: "Two"
}) })
const res = await request const res = await request
.post(`/api/views/query/TestView`) .get(`/api/views/TestView?stats=true&group=Category`)
.send({
meta: {
groupBy: "Category"
}
})
.set(defaultHeaders(app._id, instance._id)) .set(defaultHeaders(app._id, instance._id))
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)

View File

@ -14,10 +14,6 @@ module.exports = async (ctx, next) => {
return return
} }
// ctx.user = {
// instanceId: "inst_4e6f424_970ca7f2b9e24ec8896eb10862d7f22b"
// }
const appToken = ctx.cookies.get("budibase:token") const appToken = ctx.cookies.get("budibase:token")
const builderToken = ctx.cookies.get("builder:token") const builderToken = ctx.cookies.get("builder:token")