forked from tsai/budibase
68 changed files with 129 additions and 71 deletions
@ -1,8 +1,8 @@ |
|||
import { writable } from "svelte/store" |
|||
import { queries } from "./" |
|||
import api from "../../api" |
|||
import api from "builderStore/api" |
|||
|
|||
function createDatasourcesStore() { |
|||
export function createDatasourcesStore(_api = api) { |
|||
const { subscribe, update, set } = writable({ |
|||
list: [], |
|||
selected: null, |
|||
@ -1,7 +1,8 @@ |
|||
import { writable } from "svelte/store" |
|||
import api from "../../api" |
|||
import api from "builderStore/api" |
|||
|
|||
function createPermissionStore() { |
|||
|
|||
export function createPermissionStore() { |
|||
const { subscribe, set } = writable([]) |
|||
|
|||
return { |
|||
@ -1,8 +1,9 @@ |
|||
import { writable, get } from "svelte/store" |
|||
import { datasources, integrations } from "./" |
|||
import api from "../../api" |
|||
import api from "builderStore/api" |
|||
|
|||
function createQueriesStore() { |
|||
|
|||
export function createQueriesStore() { |
|||
const { subscribe, set, update } = writable({ list: [], selected: null }) |
|||
|
|||
return { |
|||
@ -1,7 +1,8 @@ |
|||
import { writable } from "svelte/store" |
|||
import api from "../../api" |
|||
import api from "builderStore/api" |
|||
|
|||
function createRolesStore() { |
|||
|
|||
export function createRolesStore() { |
|||
const { subscribe, set } = writable([]) |
|||
|
|||
return { |
|||
@ -1,7 +1,7 @@ |
|||
import { writable, get } from "svelte/store" |
|||
import { views } from "./" |
|||
|
|||
function createRowsStore() { |
|||
export function createRowsStore() { |
|||
const { subscribe } = writable([]) |
|||
|
|||
return { |
|||
@ -1,9 +1,10 @@ |
|||
import { writable, get } from "svelte/store" |
|||
import { views } from "./" |
|||
import { cloneDeep } from "lodash/fp" |
|||
import api from "../../api" |
|||
import api from "builderStore/api" |
|||
|
|||
function createTablesStore() { |
|||
|
|||
export function createTablesStore() { |
|||
const store = writable({ |
|||
list: [], |
|||
selected: {}, |
|||
@ -0,0 +1,26 @@ |
|||
import { database } from "../" |
|||
|
|||
describe("Backend DataSources Store", () => { |
|||
|
|||
let state; |
|||
let unsub; |
|||
|
|||
beforeEach(() => { |
|||
unsub = database.subscribe(s => state = s); |
|||
}) |
|||
afterEach(() => { |
|||
unsub() |
|||
}) |
|||
|
|||
it("initialises correctly", () => { |
|||
expect(state.list, []) |
|||
}) |
|||
}) |
|||
|
|||
const api = { |
|||
post: () => ({}), |
|||
get: () => ({}), |
|||
patch: () => ({}), |
|||
delete: () => ({}), |
|||
put: () => ({}), |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
import { get } from 'svelte/store' |
|||
import { createDatasourcesStore } from "../datasources" |
|||
|
|||
const mockApi = { |
|||
post: () => ({}), |
|||
get: () => ({}), |
|||
patch: () => ({}), |
|||
delete: () => ({}), |
|||
put: () => ({}), |
|||
} |
|||
|
|||
|
|||
describe("Automation Data Object", () => { |
|||
let store |
|||
|
|||
beforeEach(() => { |
|||
store = createDatasourcesStore(mockApi) |
|||
}) |
|||
|
|||
it("Inits properly", () => { |
|||
const value = get(store) |
|||
expect(value).toBe(true) |
|||
}) |
|||
}) |
|||
@ -1,8 +1,8 @@ |
|||
import { writable, get } from "svelte/store" |
|||
import { tables } from "./" |
|||
import api from "../../api" |
|||
import api from "builderStore/api" |
|||
|
|||
function createViewsStore() { |
|||
export function createViewsStore() { |
|||
const { subscribe, update } = writable({ |
|||
list: [], |
|||
selected: null, |
|||
Loading…
Reference in new issue