mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 02:54:07 +00:00
fileStorage/reducers: drop use of Set
Using set causes problems with tooling that mocks the global app state, so stick with arrays.
This commit is contained in:
@@ -140,7 +140,7 @@ describe('setEditSession', () => {
|
||||
it('should wait for storage to be initialized', async () => {
|
||||
const mockEditor = mock<monaco.editor.ICodeEditor>();
|
||||
const saga = new AsyncSaga(editor, {
|
||||
fileStorage: { isInitialized: false, fileNames: new Set() },
|
||||
fileStorage: { isInitialized: false, fileNames: [] },
|
||||
});
|
||||
|
||||
saga.put(setEditSession(mockEditor));
|
||||
@@ -155,7 +155,7 @@ describe('setEditSession', () => {
|
||||
it('should load main.py', async () => {
|
||||
const mockEditor = mock<monaco.editor.ICodeEditor>();
|
||||
const saga = new AsyncSaga(editor, {
|
||||
fileStorage: { isInitialized: true, fileNames: new Set(['main.py']) },
|
||||
fileStorage: { isInitialized: true, fileNames: ['main.py'] },
|
||||
});
|
||||
|
||||
saga.put(setEditSession(mockEditor));
|
||||
@@ -175,7 +175,7 @@ describe('setEditSession', () => {
|
||||
it('should not raise error if main.py does not exist', async () => {
|
||||
const mockEditor = mock<monaco.editor.ICodeEditor>();
|
||||
const saga = new AsyncSaga(editor, {
|
||||
fileStorage: { isInitialized: true, fileNames: new Set() },
|
||||
fileStorage: { isInitialized: true, fileNames: [] },
|
||||
});
|
||||
|
||||
saga.put(setEditSession(mockEditor));
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ function* handleSetEditSession(action: ReturnType<typeof setEditSession>): Gener
|
||||
|
||||
const fileList = yield* select((s: RootState) => s.fileStorage.fileNames);
|
||||
|
||||
if (!fileList.has(currentFileName)) {
|
||||
if (!fileList.includes(currentFileName)) {
|
||||
// The file doesn't exist in storage, so don't try to open it.
|
||||
yield* put(didSetEditSession(action.editSession));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user