Skip to content

refactor: remove axios - #1237

Merged
benjlevesque merged 13 commits into
masterfrom
refactor/remove-axios
Jan 18, 2024
Merged

refactor: remove axios#1237
benjlevesque merged 13 commits into
masterfrom
refactor/remove-axios

Conversation

@benjlevesque

@benjlevesquebenjlevesque commented Nov 13, 2023

Copy link
Copy Markdown
Contributor

Motivation

  • reduce size (minor impact)
  • avoid versions conflicts
  • reduce maintenance

Changing to MSW for mocks also has the benefit to be compatible with any client.

Choices

  • Dropping gas-price-definer. This is never used, since feat!: drop legacy storage #1117
  • dropping IpfsStore.read. This is never used.
  • remove maxSize from IpfsManager.read. This method is kept as a convenience, as it's useful to test the read after upload, but is no longer used (since feat!: drop legacy storage #1117).
  • axios remains a devDependency of smart-contracts and toolbox for now

@benjlevesquebenjlevesque changed the title refactor/remove axiosbuild(deps): Bump axios from 0.27.2 to 1.6.0 refactor: remove axiosNov 13, 2023
@benjlevesquebenjlevesque changed the title build(deps): Bump axios from 0.27.2 to 1.6.0 refactor: remove axiosrefactor: remove axiosNov 13, 2023
Comment threadpackages/request-node/src/request/getChannelsByTopic.ts Outdated
Comment threadpackages/request-node/src/request/persistTransaction.ts Outdated
.expect(StatusCodes.INTERNAL_SERVER_ERROR);
});

it('should catch IPFS timeout error', async () => {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I decided to remove this test. it's a bit hard to replicate and I feel it has no real value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I disagree with this. The Request Node still writes to IPFS but it should fail gracefully if for some reason that write fails.

Comment threadpackages/ethereum-storage/test/ipfs-manager.test.ts Outdated
Comment on lines -187 to -190
expect(config.headers[httpConfigDefaults.requestClientVersionHeader]).toBe(
packageJson.version,
);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I ditched that test, I don't really see the intention

Comment threadpackages/request-client.js/test/index.test.ts Outdated
@benjlevesque
benjlevesque changed the base branch from master to test/reduce-flaky-testsNovember 28, 2023 16:17
Base automatically changed from test/reduce-flaky-tests to masterDecember 19, 2023 11:29
@coveralls

coveralls commented Jan 17, 2024

Copy link
Copy Markdown

Coverage Status

coverage: 86.667% (-0.5%) from 87.128%
when pulling 8e03773 on refactor/remove-axios
into 45d1f5b on master.

@yomarionyomarion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice

@yomarion

Copy link
Copy Markdown
Contributor

FYI @benjlevesque, the yarn.lock file still references axios@0.27.2 that looks unused.

@benjlevesque

Copy link
Copy Markdown
ContributorAuthor

@yomarion

  • axios remains a devDependency of smart-contracts and toolbox for now

@alexandre-abriouxalexandre-abrioux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice! ✨

mockServer.close();
});

it('specify the Request Client version in the header', async () => {

@alexandre-abriouxalexandre-abriouxJan 17, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I couldn't find where we assert in this test that the client version is passed down in the headers. Is the test name wrong, or is this assertion missing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What was the conclusion here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it was a typo and it was renamed back to the original name. cc @benjlevesque can you confirm?

@benjlevesquebenjlevesqueJan 22, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

yes, sorry my comment remained "pending":

good catch. Probably a bad merge or copy paste, I removed that test

but in the meantime I also added back a check on the version header

Comment threadpackages/request-client.js/test/index.test.ts Outdated
@benjlevesque
benjlevesque enabled auto-merge (squash) January 18, 2024 10:12
Sign up for freeto 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.

5 participants

@benjlevesque@coveralls@yomarion@MantisClone@alexandre-abrioux