[GH-ISSUE #133] Write Unit Tests #135

Open
opened 2026-03-03 19:48:49 +03:00 by kerem · 2 comments
Owner

Originally created by @NghiaTranUIT on GitHub (Nov 7, 2022).
Original GitHub issue: https://github.com/ProxymanApp/proxyman-windows-linux/issues/133

Originally assigned to: @kics223w1 on GitHub.

Description

Let double check some important use cases and write some missing unit tests

Acceptance Criteria

All current Unit Tests should be passed

  • filter.test.jsx
  • harBuilder.jsx
  • harmodel.jsx
  • sslproxying.test.jsx
  • proxycore.js

Add new unit tests

proxymanlogv2.test.jsx

  • Export to proxymanlogv2 -> Import again -> Check they are the same
  • Import a proxymanlogv2 file (export from Proxyman for macOS) -> Import to app -> Test if they are the same (Same number of flow, same request/response)

proxycore.test.js

The general idea of how to write unit tests for the ProxyCore.

  1. Start the proxyServer at port 10000 (Must Disable all Tools)
  2. Make a Request to http://httpbin.org by Axios (Axios must proxy to localhost:10000)
  3. Get the response from Axios
  4. Verify the Response with the expected output
  • Make a GET HTTP (http://httpbin.org) with some query -> Verify the Response
  • Make sure to Enable SSL proxying on the httpbin.org -> Make a POST HTTPS (https://httpbin.org) with some query, JSON Body -> Verify the Response
  • Make sure to Enable SSL proxying on the httpbin.org -> Make a POST HTTPS (https://httpbin.org) with some query, Form Body -> Verify the Response

repeat-tool.test.js

  1. Start the proxyServer at port 10000 (Must Disable all Tools)
  2. Make a Request to http://httpbin.org by Axios (Axios must proxy to localhost:10000)
  3. Get the flow from the Flow Pool -> Repeat this flow
  4. Verify the Response with the expected output
  • Make a GET HTTP (http://httpbin.org) with some query
  • Make sure to Enable SSL proxying on the httpbin.org -> Make a POST HTTPS (https://httpbin.org) with some query, JSON Body -> Verify the Response
  • Make sure to Enable SSL proxying on the httpbin.org -> Make a POST HTTPS (https://httpbin.org) with some query, Form Body -> Verify the Response

no-caching-tool.test.js

  1. Start the proxyServer at port 10000 (Must Disable all Tools)
  2. Enable the No Caching Tool
  3. Make a Request to http://httpbin.org by Axios (Axios must proxy to localhost:10000)
  4. Get the response from Axios
  5. Verify the Response with the expected output
  • Make a GET HTTPS (https://httpbin.org) with some query -> Verify the Response header has some no-caching header
Originally created by @NghiaTranUIT on GitHub (Nov 7, 2022). Original GitHub issue: https://github.com/ProxymanApp/proxyman-windows-linux/issues/133 Originally assigned to: @kics223w1 on GitHub. ## Description Let double check some important use cases and write some missing unit tests ## Acceptance Criteria ### All current Unit Tests should be passed - [x] `filter.test.jsx` - [x] `harBuilder.jsx` - [x] `harmodel.jsx` - [x] `sslproxying.test.jsx` - [x] `proxycore.js` ### Add new unit tests #### proxymanlogv2.test.jsx - [x] Export to proxymanlogv2 -> Import again -> Check they are the same - [ ] Import a `proxymanlogv2` file (export from Proxyman for macOS) -> Import to app -> Test if they are the same (Same number of flow, same request/response) #### proxycore.test.js The general idea of how to write unit tests for the ProxyCore. 1. Start the proxyServer at port 10000 (Must Disable all Tools) 2. Make a Request to http://httpbin.org by Axios (Axios must proxy to localhost:10000) 3. Get the response from Axios 4. Verify the Response with the expected output - [x] Make a GET HTTP (http://httpbin.org) with some query -> Verify the Response - [x] Make sure to Enable SSL proxying on the `httpbin.org` -> Make a POST HTTPS (https://httpbin.org) with some query, JSON Body -> Verify the Response - [x] Make sure to Enable SSL proxying on the `httpbin.org` -> Make a POST HTTPS (https://httpbin.org) with some query, Form Body -> Verify the Response #### repeat-tool.test.js 1. Start the proxyServer at port 10000 (Must Disable all Tools) 2. Make a Request to http://httpbin.org by Axios (Axios must proxy to localhost:10000) 3. Get the flow from the Flow Pool -> Repeat this flow 4. Verify the Response with the expected output - [x] Make a GET HTTP (http://httpbin.org) with some query - [x] Make sure to Enable SSL proxying on the `httpbin.org` -> Make a POST HTTPS (https://httpbin.org) with some query, JSON Body -> Verify the Response - [x] Make sure to Enable SSL proxying on the `httpbin.org` -> Make a POST HTTPS (https://httpbin.org) with some query, Form Body -> Verify the Response #### no-caching-tool.test.js 1. Start the proxyServer at port 10000 (Must Disable all Tools) 2. Enable the No Caching Tool 3. Make a Request to http://httpbin.org by Axios (Axios must proxy to localhost:10000) 4. Get the response from Axios 5. Verify the Response with the expected output - [x] Make a GET HTTPS (https://httpbin.org) with some query -> Verify the Response header has some no-caching header
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 14, 2022):

Requirement Update 1

  • Make sure to Enable SSL proxying on the httpbin.org -> Make a GET HTTPS (https://httpbin.org/get) with some query by axios -> Verify the axios successes and response body has correct data.
<!-- gh-comment-id:1313331747 --> @NghiaTranUIT commented on GitHub (Nov 14, 2022): ### Requirement Update 1 - [x] Make sure to Enable SSL proxying on the httpbin.org -> Make a GET HTTPS (https://httpbin.org/get) with some query by axios -> Verify the axios successes and response body has correct data.
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 16, 2022):

Requirement Update 2

  • Try to run the Unit Tests on Ubuntu VM instance (instead of macOS, because it's 3x expense)
  • Combine npm run jest + npm run test into 1 Job
<!-- gh-comment-id:1316182283 --> @NghiaTranUIT commented on GitHub (Nov 16, 2022): ## Requirement Update 2 - [ ] Try to run the Unit Tests on Ubuntu VM instance (instead of macOS, because it's 3x expense) - [x] Combine `npm run jest` + `npm run test` into 1 Job
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxyman-windows-linux#135
No description provided.