Skip to content

Commit 15a3641

Browse files
committed
New folder structure for cloud functions tests
1 parent 220275f commit 15a3641

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"deploy": "firebase deploy --only functions",
1010
"logs": "firebase functions:log",
1111
"setup-firebase": "node setupProject.js",
12-
"test": "mocha -r ts-node/register test/**/*.test.ts --timeout 10000"
12+
"test": "mocha -r ts-node/register --recursive 'test/**/*.test.ts' --timeout 10000"
1313
},
1414
"engines": {
1515
"node": "10"

functions/test/onDelete.test.ts renamed to functions/test/db/users/onDelete.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { admin, test } from './util/admin';
1+
import { admin, test } from '../../util/admin';
22
import * as chai from 'chai';
33
import * as chaiAsPromised from 'chai-as-promised';
4-
import * as onDelete from '../src/db/users/onDelete.function';
4+
import * as onDelete from '../../../src/db/users/onDelete.function';
55
import 'mocha';
66

77
chai.use(chaiAsPromised);

functions/test/onUpdate.test.ts renamed to functions/test/db/users/onUpdate.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { admin, test } from './util/admin';
1+
import { admin, test } from '../../util/admin';
22
import * as chai from 'chai';
3-
import * as onUpdate from '../src/db/users/onUpdate.function';
3+
import * as onUpdate from '../../../src/db/users/onUpdate.function';
44
import 'mocha';
55

66
describe('onUpdate', () => {

functions/test/createUser.test.ts renamed to functions/test/https/createUser.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { admin, test } from './util/admin';
1+
import { admin, test } from '../util/admin';
22
import { https } from 'firebase-functions';
33
import * as chai from 'chai';
4-
import * as createUser from '../src/https/createUser.function';
4+
import * as createUser from '../../src/https/createUser.function';
55
import 'mocha';
66

77
describe('createUser', () => {
@@ -20,11 +20,8 @@ describe('createUser', () => {
2020
};
2121

2222
return chai
23-
.expect(wrapped(data))
24-
.to.be.rejectedWith(
25-
https.HttpsError,
26-
'auth/invalid-email'
27-
);
23+
.expect(wrapped(data))
24+
.to.be.rejectedWith(https.HttpsError, 'auth/invalid-email');
2825
});
2926

3027
it('should create the user in auth with correct email and custom claims', () => {

0 commit comments

Comments
 (0)