forked from NickColley/semaphore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle status edit events (nolanlawson#2325)
- Loading branch information
1 parent
695432e
commit 2537bd0
Showing
6 changed files
with
103 additions
and
17 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
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,13 @@ | ||
import { database } from '../_database/database.js' | ||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask.js' | ||
|
||
async function doUpdateStatus (instanceName, newStatus) { | ||
console.log('updating status', newStatus) | ||
await database.updateStatus(instanceName, newStatus) | ||
} | ||
|
||
export function updateStatus (instanceName, newStatus) { | ||
scheduleIdleTask(() => { | ||
/* no await */ doUpdateStatus(instanceName, newStatus) | ||
}) | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
getNthStatus, getUrl, goBack, | ||
sleep | ||
} from '../utils' | ||
import { loginAsFoobar } from '../roles' | ||
import { postAs, putAs } from '../serverActions' | ||
|
||
fixture`140-editing.js` | ||
.page`http://localhost:4002` | ||
|
||
test('Edited toots are updated in the UI', async t => { | ||
const { id: statusId } = await postAs('admin', 'yolo') | ||
await sleep(500) | ||
|
||
await loginAsFoobar(t) | ||
await t.expect(getNthStatus(1).innerText).contains('yolo', { timeout: 20000 }) | ||
|
||
await putAs('admin', 'wait I mean YOLO', statusId) | ||
await sleep(500) | ||
|
||
await t.click(getNthStatus(1)) | ||
.expect(getUrl()).contains('/statuses') | ||
.expect(getNthStatus(1).innerText).contains('wait I mean YOLO', { timeout: 20000 }) | ||
await goBack() | ||
await t | ||
.expect(getUrl()).eql('http://localhost:4002/') | ||
.expect(getNthStatus(1).innerText).contains('wait I mean YOLO', { timeout: 20000 }) | ||
}) |