[tests][iid] more coverage including change: getToken & deleteToken now have option args with defaults that use app.options.messagingSenderId
as authorizedEntity and '*' as scope
This commit is contained in:
parent
6a7d3ddc7a
commit
8aac77b3ac
@ -1,4 +1,4 @@
|
|||||||
describe('iid()', () => {
|
describe.only('iid()', () => {
|
||||||
describe('get()', () => {
|
describe('get()', () => {
|
||||||
it('returns instance id string', async () => {
|
it('returns instance id string', async () => {
|
||||||
const iid = await firebase.iid().get();
|
const iid = await firebase.iid().get();
|
||||||
@ -10,13 +10,56 @@ describe('iid()', () => {
|
|||||||
it('deletes the current instance id', async () => {
|
it('deletes the current instance id', async () => {
|
||||||
const iidBefore = await firebase.iid().get();
|
const iidBefore = await firebase.iid().get();
|
||||||
iidBefore.should.be.a.String();
|
iidBefore.should.be.a.String();
|
||||||
|
|
||||||
await firebase.iid().delete();
|
await firebase.iid().delete();
|
||||||
|
|
||||||
const iidAfter = await firebase.iid().get();
|
const iidAfter = await firebase.iid().get();
|
||||||
iidAfter.should.be.a.String();
|
iidAfter.should.be.a.String();
|
||||||
|
|
||||||
iidBefore.should.not.equal(iidAfter);
|
iidBefore.should.not.equal(iidAfter);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getToken()', () => {
|
||||||
|
it('should return an FCM token from getToken with arguments', async () => {
|
||||||
|
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
|
||||||
|
|
||||||
|
await firebase.iid().delete();
|
||||||
|
const token = await firebase.iid().getToken(authorizedEntity, '*');
|
||||||
|
token.should.be.a.String();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an FCM token from getToken without arguments', async () => {
|
||||||
|
await firebase.iid().delete();
|
||||||
|
const token = await firebase.iid().getToken();
|
||||||
|
token.should.be.a.String();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an FCM token from getToken with 1 argument', async () => {
|
||||||
|
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
|
||||||
|
|
||||||
|
await firebase.iid().delete();
|
||||||
|
const token = await firebase.iid().getToken(authorizedEntity);
|
||||||
|
token.should.be.a.String();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('deleteToken()', () => {
|
||||||
|
it('should return nil from deleteToken with arguments', async () => {
|
||||||
|
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
|
||||||
|
|
||||||
|
const token = await firebase.iid().deleteToken(authorizedEntity, '*');
|
||||||
|
should.not.exist(token);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return nil from deleteToken without arguments', async () => {
|
||||||
|
const token = await firebase.iid().deleteToken();
|
||||||
|
should.not.exist(token);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return nil from deleteToken with 1 argument', async () => {
|
||||||
|
const authorizedEntity = firebase.iid().app.options.messagingSenderId;
|
||||||
|
|
||||||
|
const token = await firebase.iid().deleteToken(authorizedEntity);
|
||||||
|
should.not.exist(token);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user