31 Commits
Author SHA1 Message Date
David LechnerandDavid Lechner af160c99a8 more code coverage 2023-03-08 15:07:16 -06:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>dependabot-fixDavid Lechner
35312810c3 build(deps): bump @testing-library/user-event from 14.4.1 to 14.4.2 (#1035)
* build(deps): bump @testing-library/user-event from 14.4.1 to 14.4.2

Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 14.4.1 to 14.4.2.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v14.4.1...v14.4.2)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* test/index: fix breaking change from testing-library/user-event update

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-08-05 19:54:11 +00:00
David Lechner 1e0d44bbe4 Fixed deleting files that are not open in the editor. 2022-07-06 17:56:08 -05:00
David LechnerandDavid Lechner 2686e0e5d3 use redux toolkit
Using redux directly has been deprecated. Using redux toolkit offers
some more safety checks (and could potientially replace some use of
sagas).
2022-06-15 12:03:29 -05:00
David LechnerandDavid Lechner 883807b4b4 fix breaking changes for user-event v14 2022-06-02 18:45:28 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>David Lechner
09c07affa3 build(deps): bump jest and @types/jest (#835)
* build(deps): bump jest and @types/jest

Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) and [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest). These dependencies needed to be updated together.

Updates `jest` from 27.5.1 to 28.1.0
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v28.1.0/packages/jest)

Updates `@types/jest` from 27.4.1 to 28.1.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/jest"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix breaking changes in jest 28

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-06-02 18:53:21 +00:00
David Lechner a005992a21 fileStorage: use dexie-react-hooks
This lets the dexie-react-hooks library do more of the work for us
instead of having to make redux-sagas wrappers for everything.
2022-05-18 17:06:08 -05:00
David Lechner 8ac77560fb editor: add tabs for controlling open/active files 2022-04-07 21:17:09 -05:00
David Lechner b9dbaaa5cb fileStorage: implement file locks
This breaks down reading and writing into low-level and high level sagas.

Opening now takes a lock on the file so that it can only have one writer
or have multiple readers. The low-level read and write sagas use the
file descriptor to determine if the file is still open before actually
performing the action.

Since we are using the web locks api, these locks should work across
browser tabs/windows.

The high-level read/write sagas perform the low-level open, read/write,
close operations in a single call.

The high-level delete and rename sagas are also updated to take locks
on the files while performing the respective operations and will fail
if the file is already being used somewhere else.
2022-04-04 15:24:08 -05:00
David Lechner 1709591afc fileStorage: untangle file id/name
We were using file UUID and path interchangeable. This adds a new UUID
type for static checking and fixes a bunch of issues found.
2022-04-01 17:24:00 -05:00
David Lechner 1515e5ae4f fileStorage: add file handles
This changes how files work. There is now an open function that
translates a path to a file handle (id). Then this handle is used
to perform other actions on the file. The file contents are moved
to a separate table so that the actual file storage is independent
of the database (e.g. in the future, we may use File Access API).

We store a hash of the file contents in the metadata file so we can
detect file changes without having to compare file contents.

We also separate the change and add actions.
2022-04-01 13:41:10 -05:00
David Lechner 110d93860a test: add timeout to saga take
This will crash tests sooner and give a stack track at the crash point
instead of waiting the default 5 seconds for the entire test to timeout
(which doesn't give a stack trace of where the test was when it timed
out).
2022-03-28 11:48:08 -05:00
David Lechner 9de4227ec1 explorer: use keyboard accessible tree 2022-03-19 18:21:00 -05:00
David Lechner 7c0de33cfc test: drop | END
END already matches AnyAction so doesn't need to be explicitly added.
2022-03-11 16:11:22 -06:00
David Lechner 31fb3b9e4c test: drop state from AsyncSaga constructor params
This uses the real rootReducer to populate the initial state in the test
AsyncSaga. This way we don't have to populate default values. Since it
isn't used often, we can omit the parameter and just call the updateState()
method after creating the object if modifications are needed.
2022-03-11 16:04:09 -06:00
David Lechner 7b08d8a7bf test: drop RecursivePartial type
There is an existing type we can use instead.
2022-03-11 15:42:42 -06:00
David Lechner b37209683b test: extend testRender to return spy on dispatch 2022-03-10 02:00:14 -06:00
David Lechner 6afee4b6d6 test: add testRender()
This adds a testRender() helper function to simplify UI tests. Instead
of mocking the redux store, we use the real thing.
2022-03-09 17:24:46 -06:00
David Lechner 569217d5dc editor: don't put editor in redux store
The redux store should not have non-serializable objects like the editor
in it.
2022-03-02 18:56:47 -06:00
David Lechner 994540e263 actions: fix missed refactoring
Missed some renames when refactoring that weren't picked up locally
for some reason.
2022-02-26 12:55:49 -06:00
David Lechner 5d9040647b fix two-level merging of state in tests 2021-01-23 15:46:20 -06:00
David Lechner c1c08e5ced add state initializer in async saga constructor 2021-01-22 15:58:10 -06:00
David Lechner 08fea237c9 change setState() to updateState()
this way we don't wipe out state if we change a different value
2021-01-22 15:58:10 -06:00
David Lechner caacaad341 use recursive partial so we don't have to use "as" 2021-01-22 10:35:11 -06:00
David Lechner da298ab565 add some tests for notification sagas 2021-01-18 17:29:04 -06:00
David Lechner b6bda26484 fix error handling in test saga
Jest used to define fail() but doesn't seem to do this anymore.
Replace it with throwing an error instead, which is basically the
same thing.
2021-01-14 10:50:28 -06:00
David LechnerandDavid Lechner 71ad9c1b1b Update to create-react-app 4
- had to update eslint deps
- ran into https://github.com/palantir/blueprint/issues/4112
- had to move beta.svg out of static/
- had to fix prettier formatting changes
- ran into https://github.com/facebook/jest/issues/7780
2020-11-20 21:08:53 -06:00
David LechnerandDavid Lechner c3d4a07053 fix TextEncoder/TextDecoder on CI
was working locally but not on CI for some reason
2020-06-10 21:59:34 -05:00
David LechnerandDavid Lechner 17cb5a32d5 convert editor service to saga 2020-06-10 21:59:34 -05:00
David LechnerandDavid Lechner 5c3ec89e3b add test for editor saga 2020-06-10 21:59:34 -05:00
David LechnerandDavid Lechner 31c3e2b52e refactor common test helpers into test/
This way we can share them with multiple tests
2020-06-10 21:59:34 -05:00