2018-07-14 23:47:00 +00:00
|
|
|
describe('iid()', () => {
|
2018-04-11 01:45:47 +00:00
|
|
|
describe('get()', () => {
|
|
|
|
it('returns instance id string', async () => {
|
|
|
|
const iid = await firebase.iid().get();
|
|
|
|
iid.should.be.a.String();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('delete()', () => {
|
|
|
|
it('deletes the current instance id', async () => {
|
|
|
|
const iidBefore = await firebase.iid().get();
|
|
|
|
iidBefore.should.be.a.String();
|
|
|
|
await firebase.iid().delete();
|
|
|
|
|
|
|
|
const iidAfter = await firebase.iid().get();
|
|
|
|
iidAfter.should.be.a.String();
|
|
|
|
iidBefore.should.not.equal(iidAfter);
|
|
|
|
});
|
|
|
|
});
|
2018-07-14 23:45:04 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
2018-04-11 01:45:47 +00:00
|
|
|
});
|