Store: remove all mentions of window.Store (#127077)
* Store: remove all mentions of window.Store * Apply suggestion from @BenyFilho Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com> --------- Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
This commit is contained in:
parent
9e42f1e0c3
commit
883d7e4eda
14 changed files with 522 additions and 754 deletions
|
|
@ -84,8 +84,8 @@ describe('Client', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Authentication', function() {
|
||||
it('should emit QR code if not authenticated', async function() {
|
||||
describe('Authentication', function () {
|
||||
it('should emit QR code if not authenticated', async function () {
|
||||
this.timeout(25000);
|
||||
const callback = sinon.spy();
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ describe('Client', function() {
|
|||
const qrCallback = sinon.spy();
|
||||
const disconnectedCallback = sinon.spy();
|
||||
|
||||
const client = helper.createClient({options: {qrMaxRetries: 2}});
|
||||
const client = helper.createClient({ options: { qrMaxRetries: 2 } });
|
||||
client.on('qr', qrCallback);
|
||||
client.on('disconnected', disconnectedCallback);
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ describe('Client', function() {
|
|||
expect(disconnectedCallback.calledOnceWith('Max qrcode retries reached')).to.eql(true);
|
||||
});
|
||||
|
||||
it('should authenticate with existing session', async function() {
|
||||
it('should authenticate with existing session', async function () {
|
||||
this.timeout(40000);
|
||||
|
||||
const authenticatedCallback = sinon.spy();
|
||||
|
|
@ -137,6 +137,7 @@ describe('Client', function() {
|
|||
await client.initialize();
|
||||
|
||||
expect(authenticatedCallback.called).to.equal(true);
|
||||
|
||||
expect(readyCallback.called).to.equal(true);
|
||||
expect(qrCallback.called).to.equal(false);
|
||||
|
||||
|
|
@ -163,71 +164,6 @@ describe('Client', function() {
|
|||
console.log(`WA Version: ${version}`);
|
||||
});
|
||||
|
||||
describe('Expose Store', function() {
|
||||
it('exposes the store', async function() {
|
||||
const exposed = await client.pupPage.evaluate(() => {
|
||||
return Boolean(window.Store);
|
||||
});
|
||||
|
||||
expect(exposed).to.equal(true);
|
||||
});
|
||||
|
||||
it('exposes all required WhatsApp Web internal models', async function() {
|
||||
const expectedModules = [
|
||||
'AppState',
|
||||
'BlockContact',
|
||||
'Call',
|
||||
'Chat',
|
||||
'ChatState',
|
||||
'Cmd',
|
||||
'Conn',
|
||||
'Contact',
|
||||
'DownloadManager',
|
||||
'EphemeralFields',
|
||||
'Features',
|
||||
'GroupMetadata',
|
||||
'GroupParticipants',
|
||||
'GroupUtils',
|
||||
'Invite',
|
||||
'InviteInfo',
|
||||
'JoinInviteV4',
|
||||
'Label',
|
||||
'MediaObject',
|
||||
'MediaPrep',
|
||||
'MediaTypes',
|
||||
'MediaUpload',
|
||||
'MessageInfo',
|
||||
'Msg',
|
||||
'MsgKey',
|
||||
'OpaqueData',
|
||||
'QueryOrder',
|
||||
'QueryProduct',
|
||||
'PresenceUtils',
|
||||
'ProfilePic',
|
||||
'QueryExist',
|
||||
'QueryProduct',
|
||||
'QueryOrder',
|
||||
'SendClear',
|
||||
'SendDelete',
|
||||
'SendMessage',
|
||||
'SendSeen',
|
||||
'StatusUtils',
|
||||
'UploadUtils',
|
||||
'UserConstructor',
|
||||
'VCard',
|
||||
'Validators',
|
||||
'WidFactory',
|
||||
'findCommonGroups',
|
||||
'sendReactionToMsg',
|
||||
];
|
||||
|
||||
const loadedModules = await client.pupPage.evaluate((expectedModules) => {
|
||||
return expectedModules.filter(m => Boolean(window.Store[m]));
|
||||
}, expectedModules);
|
||||
|
||||
expect(loadedModules).to.have.members(expectedModules);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Send Messages', function () {
|
||||
it('can send a message', async function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue