Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

node.js - Facing issues while Unit Testing with Firebase

I'm currently trying to Test With Supertest in Authentication with Firebase. But it doesn't work and I didn't understand the problems with the code.

here is my code snippet

import supertest, { SuperTest, Test } from 'supertest';
import admin from '../../../src/routes/v1/auth/firebase';
const request: SuperTest<Test> = supertest(app);
const uid = 'helloWorld';

const Token = admin
  .auth()
  .createCustomToken(uid)
  .then((customToken) => {
  return customToken;
  });

describe('POST /some-url', function() {
 it('POST/userAuth', async (done) => {
  const res = await request
                          .post('/v1/user/haha')
                          .set('Authorization', `bearer ${Token}`)
                          .send({
                            title: 'Some random text',
                            options: [
                              { start: hello, end: world },
                              { start: good, end: bye },
                            ],
                          });
});

Please help me to figure out the problem?

Thanks in Advance :)

question from:https://stackoverflow.com/questions/65873597/facing-issues-while-unit-testing-with-firebase

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...