Skip to content

Commit 7e1101f

Browse files
committed
Fix tests, data route
1 parent 4b868fe commit 7e1101f

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

data-browser/src/routes/DataRoute.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ function Data(): JSX.Element {
2929
}
3030

3131
async function fetchAs(contentType: string) {
32-
const requestHeaders: HeadersInit = new Headers();
33-
const headers = await signRequest(subject, agent, requestHeaders);
34-
requestHeaders.set('Accept', contentType);
32+
let headers: HeadersInit = new Headers();
33+
headers.set('Accept', contentType);
34+
if (agent) {
35+
headers = await signRequest(subject, agent, headers);
36+
}
3537
setTextResponse('loading...');
3638
try {
3739
const resp = await window.fetch(subject, { headers });

data-browser/src/views/DocumentPage.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,13 @@ function DocumentPageShow({
290290
<>
291291
<div style={{ display: 'flex', flexDirection: 'row' }}>
292292
<h1 style={{ flex: 1 }}>{title}</h1>
293-
<Button icon subtle onClick={() => setEditMode(true)} title='Edit mode'>
293+
<Button
294+
data-test='document-edit'
295+
icon
296+
subtle
297+
onClick={() => setEditMode(true)}
298+
title='Edit mode'
299+
>
294300
<FaEdit />
295301
</Button>
296302
</div>

data-browser/tests/browser.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ test.describe('data-browser', async () => {
1818
await page.goto('http://localhost:8080/');
1919
await page.setViewportSize({ width: 1200, height: 800 });
2020
await page.click(sidebarDriveEdit);
21-
await signIn(page);
2221
await openLocalhost(page);
2322
});
2423

@@ -171,6 +170,7 @@ test.describe('data-browser', async () => {
171170

172171
// commit for editing title
173172
await page.waitForResponse('http://localhost/commit');
173+
// await page.click('[data-test="document-edit"]');
174174
// await expect(await page.title()).toEqual(title);
175175
await page.press(documentTitle, 'Enter');
176176
await page.waitForTimeout(500);

0 commit comments

Comments
 (0)