-
Notifications
You must be signed in to change notification settings - Fork 373
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
fix(fcm): Exporting all types of Messages so they can be used by consumers #1147
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e6336e3
feat: Exporting all types of Messages so they can be used by consumers
BorntraegerMarc 6a69e71
feat(exportMessageTypes): Testing TokenMessage
BorntraegerMarc 8755878
feat(exportMessageTypes): Added tests for all Message types
BorntraegerMarc b471877
feat(exportMessageTypes): Fixed build
BorntraegerMarc 5f4b793
Merge branch 'master' into patch-1
BorntraegerMarc df80c59
feat(exportMessageTypes): Better unit tests
BorntraegerMarc dce2e00
feat(exportMessageTypes): Deleted unneeded separate TS test
BorntraegerMarc fca55b7
feat(exportMessageTypes): Fixed build
BorntraegerMarc e99eee0
feat(exportMessageTypes): Fixed linting
BorntraegerMarc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*! | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import * as chai from 'chai'; | ||
import * as chaiAsPromised from 'chai-as-promised'; | ||
|
||
import { messaging } from '../../src/messaging/index'; | ||
|
||
chai.should(); | ||
chai.use(chaiAsPromised); | ||
|
||
const expect = chai.expect; | ||
|
||
describe('Typescript', () => { | ||
// This test was added as part of https://github.com/firebase/firebase-admin-node/issues/1146 | ||
it('should export all types of Messages so it can be used by lib users', () => { | ||
const tokenMessage: messaging.TokenMessage = { token: '' }; | ||
const topicMessage: messaging.TopicMessage = { topic: '' }; | ||
const conditionMessage: messaging.ConditionMessage = { condition: '' }; | ||
const allMessages: messaging.Message[] = [tokenMessage, topicMessage, conditionMessage] | ||
|
||
allMessages.forEach((m) => expect(m).to.not.be.undefined); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Let's try to incorporate this test logic to the existing
messaging.spec
file. No need to carve out a new file for this. Easiest would be to list it under the existing test suite for thesend()
method:Also note that when you add a new test file, you have to also list it in
index.spec.ts
. Otherwise mocha won't run it. But, let's just add this to the existing unit test file.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.
Or alternatively you can have one test case in the suite for
sendAll()
: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.
Makes sense. Thx for the guidance!
FYI mocha did run the new test. I also verified when I added the new file 🙂
Source: https://github.com/firebase/firebase-admin-node/runs/1820854315