test/FirebaseAuth.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1

Size

Lines of Code 35
Function Count 8

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 35
cc 0
rs 10
noi 0
wmc 8
mnd 0
bc 8
fnc 8
bpm 1
cpm 1

1 Function

Rating   Name   Duplication   Size   Complexity  
B FirebaseAuth.js ➔ ??? 0 28 1
1
'use strict';
2
3
let serviceKey = require('../firebase-config/firebase.service-key.json');
4
let firebaseConfig = require('../firebase-config/firebase.config.json');
5
let FirebaseAuth = require('../index.js');
6
let assert = require('assert');
7
8
describe('test', () => {
9
	let firebaseAuth = new FirebaseAuth(firebaseConfig, serviceKey);
10
11
  it('signIn should return a string with idToken', () => {
12
  	return firebaseAuth.signIn('[email protected]', 'testtest')
13
  		.then((res) => {
14
  			assert('string', typeof(res));
15
  		});
16
  });
17
18
  it('signIn should return a an object code and message', () => {
19
  	return firebaseAuth.signIn('fail', 'fail')
20
  		.catch((err) => {
21
  			assert('object', typeof(err));
22
  		});
23
  });
24
25
  it('authToken should return true if token is valid', () => {
26
    return firebaseAuth.signIn('[email protected]', 'testtest')
27
      .then((idToken) => {
28
        return firebaseAuth.authToken(idToken)
29
          .then(() => {
30
            return true;
31
          });
32
      });
33
  })
34
  
35
});
36