Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Add Jest and eslint #110

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Conversation

scrblue
Copy link

@scrblue scrblue commented Jan 1, 2022

Adds and configures Jest and eslint (over the unsupported tslint) and begins to add some initial unit testing.

Since eslint . --fix and the .editorconfig dropped cause a lot of mess in the diffs, here's a description of everything changed per commit:

  • Add jest as a dependency -- Simply adds jest and ts-jest to the dev dependencies and adds a minimal jest.config.js
  • Replace tslint with eslint did the following: add the .editorconfig, add eslint itself to the dev dependencies, copy the .eslintrc.js directly from the vircadia-web-sdk, and set up a minimal .eslintignore
  • Temporarily remove prebuild stage removes linting from the build process temporarily. This is to be added again when the errors that cannot be --fixed have been solved.
  • Update tslint inline comments to eslint inline comments did a simple find and replace from /* tslint:disable-next-line */ to // eslint-disable-next-line, however the .editorconfig muddied the diffs some.
  • Run eslint with --fix argument does what it says on the tin, rewriting massive parts of the codebase
  • Add util function to Db.ts for testing adds one function for directly setting the Datab global for use in unit tests, but again rewriting parts from the .editorconfig.

The final commits are relegated to their own files and can be reviewed easily by examining the diffs.

@@ -1,78 +1,81 @@
{
"name": "iamus-metaverse-server",
"version": "2.4.10",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name should change to "vircadia-metaverse", the author should be upgraded to "contributors", and the URL should be changed to "https://git.hub/vircadia/vircadia-metaverse" but I will include all those changes in a separate PR.

Copy link
Collaborator

@Misterblue Misterblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of work getting the eslint rules passing. Great job.
Only one code suggestion.

test("addAccount, then geting it by ID, then removing it", () => {
testDatab()
.then(() => {
const accExpected = mockAccount("test3");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than "mockAccount", you could use "Accounts.createAccount(user, pw)". This returns an AccountEntity with all the fields and doesn't update the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants