mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-07 15:09:30 +00:00
fix: await draft deletion through the card facade (#405)
Issue: #405 User-Visible: no
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { EditorSecondaryController } from '../test-build/editor-secondary.js';
|
||||
|
||||
const host = {
|
||||
root: () => ({}),
|
||||
requestUpdate() {},
|
||||
async updateComplete() {},
|
||||
clearTip() {},
|
||||
};
|
||||
|
||||
test('editor secondary context returns the current action result and rejects stale actions (#405)', async () => {
|
||||
const controller = new EditorSecondaryController(host);
|
||||
|
||||
assert.equal(controller.runContext('current', 'current', () => 42), 42);
|
||||
|
||||
const pending = Promise.resolve('finished');
|
||||
assert.equal(controller.runContext('current', 'current', () => pending), pending);
|
||||
assert.equal(await controller.runContext('current', 'current', () => pending), 'finished');
|
||||
|
||||
let staleCalled = false;
|
||||
assert.equal(controller.runContext('old', 'current', () => {
|
||||
staleCalled = true;
|
||||
return 'unexpected';
|
||||
}), undefined);
|
||||
assert.equal(staleCalled, false);
|
||||
});
|
||||
Reference in New Issue
Block a user