-
Notifications
You must be signed in to change notification settings - Fork 59
Support null value in makeDataSnapshot and update dependencies #53
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { expect } from 'chai'; | ||
import { FirebaseFunctionsTest } from '../../src/lifecycle'; | ||
import { makeDataSnapshot } from '../../src/providers/database'; | ||
|
||
describe('providers/database', () => { | ||
let test; | ||
|
||
before(() => { | ||
test = new FirebaseFunctionsTest(); | ||
test.init(); | ||
}); | ||
|
||
after(() => { | ||
test.cleanup(); | ||
}); | ||
|
||
it('produces the right snapshot with makeDataSnapshot', async () => { | ||
const snapshot = makeDataSnapshot({ | ||
foo: 'bar', | ||
}, 'path'); | ||
|
||
expect(snapshot.val()).to.deep.equal({foo: 'bar'}); | ||
expect(snapshot.ref.key).to.equal('path'); | ||
}); | ||
|
||
it('should allow null value in makeDataSnapshot', async () => { | ||
const snapshot = makeDataSnapshot(null, 'path'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit - add a newline after this line to separate the act and assert steps of this test. |
||
|
||
expect(snapshot.val()).to.deep.equal(null); | ||
expect(snapshot.ref.key).to.equal('path'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { expect } from 'chai'; | ||
import fft = require('../../src/index'); | ||
|
||
describe('providers/firestore', () => { | ||
it('produces the right snapshot with makeDocumentSnapshot', async () => { | ||
const test = fft(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit - add a newline after this line and after you call makeDocumentSnapshot, to split up the arrange ,act, and assert steps of this test |
||
|
||
const snapshot = test.firestore.makeDocumentSnapshot({ | ||
email_address: '[email protected]', | ||
}, 'collection/doc-id'); | ||
|
||
expect(snapshot.data()).to.deep.equal({ | ||
email_address: '[email protected]', | ||
}); | ||
expect(snapshot.id).to.equal('doc-id'); | ||
}); | ||
|
||
it('should allow empty document in makeDocumentSnapshot', async () => { | ||
const test = fft(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit - add a newline after this line and after you call makeDocumentSnapshot, to split up the arrange ,act, and assert steps of this test |
||
|
||
const snapshot = test.firestore.makeDocumentSnapshot({}, 'collection/doc-id'); | ||
|
||
expect(snapshot.data()).to.deep.equal(undefined); | ||
expect(snapshot.id).to.equal('doc-id'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - add a newline after this to separate the act and assert steps of this test.