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

Add integration tests. #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add integration tests. #154

wants to merge 1 commit into from

Conversation

dany-pellerin
Copy link
Contributor

@dany-pellerin dany-pellerin commented Dec 17, 2024

The purpose of this PR:

  • Adds test to try to prevent accidental breaking changes (requested by FSJ)
  • Adding integration tests to the SDK.

Add-ons will be tested in a subsequent PR.

This PR adds 2 dev dependencies:

  • jest-localstorage-mock: make it easy to test local storage
  • msw: mock edge requests

The sdk.test.js was renamed sdk.test.ts, this is to detect breaking changes, typescript will complain in the test if a property is changed.

The tests are limited to testing the interface and internal behavior of the SDK. It's still possible that changes made in edge would break the SDK.

Coverage report

 PASS  lib/sdk.test.ts
 PASS  lib/addons/gpt.test.js
 PASS  lib/addons/try-identify.test.js
 PASS  lib/addons/topics-api.test.js
 PASS  lib/edge/targeting.test.js
 PASS  lib/core/storage.test.js
 PASS  lib/core/network.test.js
------------------|---------|----------|---------|---------|-------------------
File              | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------|---------|----------|---------|---------|-------------------
All files         |   85.65 |    79.78 |   88.88 |   85.52 |                   
 lib              |     100 |    85.71 |     100 |     100 |                   
  config.ts       |     100 |      100 |     100 |     100 |                   
  sdk.ts          |     100 |    85.71 |     100 |     100 | 103-107,125       
 lib/addons       |   53.03 |    64.51 |   52.63 |   53.03 |                   
  gpt.ts          |   47.36 |     62.5 |      40 |   47.36 | 12,33-44          
  topics-api.ts   |   38.23 |    33.33 |   57.14 |   38.23 | 21-52             
  try-identify.ts |     100 |      100 |     100 |     100 |                   
 lib/core         |    98.3 |    85.71 |     100 |   98.27 |                   
  network.ts      |   95.65 |       70 |     100 |   95.65 | 35                
  storage.ts      |     100 |    94.44 |     100 |     100 | 66                
 lib/edge         |     100 |    92.85 |     100 |     100 |                   
  identify.ts     |     100 |      100 |     100 |     100 |                   
  profile.ts      |     100 |      100 |     100 |     100 |                   
  rtb2.ts         |       0 |        0 |       0 |       0 |                   
  site.ts         |     100 |      100 |     100 |     100 |                   
  targeting.ts    |     100 |    92.85 |     100 |     100 | 36                
  tokenize.ts     |     100 |      100 |     100 |     100 |                   
  uid2_token.ts   |     100 |      100 |     100 |     100 |                   
  witness.ts      |     100 |      100 |     100 |     100 |                   
 lib/test         |     100 |      100 |     100 |     100 |                   
  handlers.ts     |     100 |      100 |     100 |     100 |                   
  mocks.ts        |     100 |      100 |     100 |     100 |                   
  server.ts       |     100 |      100 |     100 |     100 |                   
------------------|---------|----------|---------|---------|-------------------

@dany-pellerin dany-pellerin self-assigned this Dec 17, 2024
@dany-pellerin dany-pellerin marked this pull request as draft December 17, 2024 21:34
@dany-pellerin dany-pellerin force-pushed the signature-tests branch 6 times, most recently from b6de6d9 to fad2239 Compare December 18, 2024 19:07
@dany-pellerin dany-pellerin requested a review from zapo December 18, 2024 19:39
@dany-pellerin dany-pellerin marked this pull request as ready for review December 18, 2024 19:39
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.

1 participant