@lvce-editor/test-worker 5.11.0 → 5.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2084,18 +2084,25 @@ const getSelections = async () => {
2084
2084
  // @ts-ignore
2085
2085
  return invoke('Editor.getSelections', numeric);
2086
2086
  };
2087
+ const getKey = async () => {
2088
+ const keys = await invoke('Editor.getKeys');
2089
+ if (keys.length === 0) {
2090
+ throw new Error(`no editor found`);
2091
+ }
2092
+ const key = keys.at(-1);
2093
+ const numeric = Number.parseInt(key);
2094
+ return numeric;
2095
+ };
2087
2096
  const shouldHaveText = async expectedText => {
2088
- const text = await invoke('Editor.getText');
2097
+ const key = await getKey();
2098
+ const text = await invoke('Editor.getText', key);
2089
2099
  if (text !== expectedText) {
2090
2100
  throw new Error(`Expected editor to have text ${expectedText} but was ${text}`);
2091
2101
  }
2092
2102
  };
2093
2103
  const shouldHaveSelections = async expectedSelections => {
2094
- const keys = await invoke('Editor.getKeys');
2095
- const key = keys.at(-1);
2096
- const numeric = Number.parseInt(key);
2097
- // @ts-ignore
2098
- const selections = await invoke('Editor.getSelections', numeric);
2104
+ const key = await getKey();
2105
+ const selections = await invoke('Editor.getSelections', key);
2099
2106
  if (!areSelectionsEqual(selections, expectedSelections)) {
2100
2107
  throw new Error(`Expected editor to have selections ${expectedSelections} but was ${selections}`);
2101
2108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "5.11.0",
3
+ "version": "5.12.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",