Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
0 answers
39 views

I am new to ts and to frontend. I want to write test that mocks query param in uri. it('should read the query parameter', () => { const stub = sinon.stub(window.location, 'search').get(() => '?...
0 votes
0 answers
44 views

Like I have this set-up main.ts import { Worker } from 'node:worker_threads'; function myParentFunc() { new Worker('worker.ts'); } worker.ts myObj.myFunc() test.ts const sandbox = sinon....
cis's user avatar
  • 1,403
0 votes
0 answers
59 views

I've writing a simple single-page application from scratch, and it has a simple router class. It works fine, and now is time to create unit tests for router. For testing, I use Mocha + Chai + JSDOM. ...
0 votes
0 answers
50 views

I have a class "SomeService" which isn't exported. I export the instance which can be used to call functions on it. Basicly a singleton. Here the example export const someService = new ...
1 vote
0 answers
173 views

I have written a WhatsApp bot using whatsapp-web.js, and it works fine in production. However, when I try to run tests, they fail, and I suspect the issue lies with my mocks, but I am not entirely ...
0 votes
1 answer
458 views

I have a very simple auth middleware with an export default () anonymous function: export default () => async (req, res, next) => { try { // some auth implementation... does not matter ...
1 vote
1 answer
48 views

I am trying test my routes but I can't stub my repository function, I want to stub the function that in the repository that calls the database. This is my test file: import { expect } from "chai&...
0 votes
0 answers
33 views

I'm unable to user supertest with sinon to stub the same function twice in the same test file. How can I do this? Here is the code I have currently: const { app } = require('../../app'); const request ...
Robert's user avatar
  • 352
1 vote
1 answer
116 views

My DB Class to test I have a DB class where i encapsulate Mongodb methods to test import mongodb from 'mongodb'; import dotenv from 'dotenv'; // Comfigure dotenv dotenv.config(); // eslint-disable-...
1 vote
0 answers
83 views

I'm trying to stub a specific Firestore Document Reference which I want to get with the Firestore get Function with Sinon. Unfortunately I'm not able to make it work. The Function which should call ...
0 votes
1 answer
60 views

I am trying to unit test all of my API calls. Every call passes the test, but i still get an error saying: ✘ Timed out while running tests Failed to exit when running test.js. I have tried adding a ...
-1 votes
1 answer
102 views

Quite new to unit testing. I am writing unit tests for my code using Chai+Mocha and Sinon and I am stuck at a point because I am not able to decide whether I should use a Sinon stub or a fake. I have ...
0 votes
1 answer
57 views

Lots of similar questions, but none that seem to fit. Say there's a nodejs function: async function handler(event) { await parseEvent(event) if(event.a) await doBusinessLogicA(event) ...
1 vote
2 answers
91 views

I want to test a Google Cloud Function written in Typescript, and the function calls publishMessage, a member function of the Topic class. How can I make a unit test capture the argument that got ...
4 votes
0 answers
213 views

I'm trying to unit tests some custom implemented edge functions with supabase-js. I'm using Deno and sinonjs for that. For my edge function i've got multiple scenarios, for the first one I want to ...

15 30 50 per page
1
2 3 4 5
...
188

AltStyle によって変換されたページ (->オリジナル) /