-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from lane711/feature/wysiwyg-editor
Feature/wysiwyg editor
- Loading branch information
Showing
5 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getTestingContext } from '../util/testing'; | ||
import { getForm } from './forms'; | ||
|
||
const ctx = getTestingContext(); | ||
|
||
it('form tests', () => { | ||
// describe('form should render test boxes', async () => { | ||
// const form = await getForm(ctx, 'posts'); | ||
// expect(form).toBeNull(); | ||
// }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,30 @@ import { drizzle } from 'drizzle-orm/d1'; | |
import { createUser } from '../auth/lucia'; | ||
import { getD1DataByTable } from '../data/d1-data'; | ||
|
||
export async function createUserAndGetToken(app, ctx, email= '[email protected]', password = 'password123', role = 'admin') { | ||
export async function getTestingContext() { | ||
const { __D1_BETA__D1DATA, KVDATA } = getMiniflareBindings(); | ||
|
||
const toJson = function (json) { | ||
return json; | ||
}; | ||
|
||
const ctx = { | ||
env: { KVDATA: KVDATA, D1DATA: __D1_BETA__D1DATA }, | ||
json: toJson, | ||
user: { id: 'fromtest' }, | ||
_var: { user: { userId: 'abc123' } } | ||
}; | ||
|
||
return ctx; | ||
} | ||
|
||
export async function createUserAndGetToken( | ||
app, | ||
ctx, | ||
email = '[email protected]', | ||
password = 'password123', | ||
role = 'admin' | ||
) { | ||
await createUserTestTables(ctx); | ||
|
||
//TODO: create user properly using the lucia api so that the user keys data in populated | ||
|
@@ -42,7 +65,7 @@ export async function createUserAndGetToken(app, ctx, email= '[email protected]', password | |
expect(res.status).toBe(200); | ||
let body = await res.json(); | ||
expect(body.bearer.length).toBeGreaterThan(10); | ||
return {id: result.user.userId, token:body.bearer}; | ||
return { id: result.user.userId, token: body.bearer }; | ||
} | ||
|
||
export async function createUserTestTables(ctx) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,5 +117,8 @@ export const fields: ApiConfig['fields'] = { | |
}, | ||
tags: { | ||
type: 'string[]' | ||
}, | ||
body: { | ||
type: 'ckeditor' | ||
} | ||
}; |