
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Include facebook-stub.js when in your testing environment, and don't include the facebook all.js
facebook-stub.js creates valid md5 sig cookie which will be passed to the server.
FacebookStub provides two global objects:
The first think you need to do is FBWorld.setSecret(Your App Secret). This allows the creation of valid cookies.
Then you can simulate different user states by using:
FBWorld.notLoggedIn();
FBWorld.loggedIn();
FBWorld.notConnected();
FBWorld.connected();
If you are not connected to the application, then when FB.login is called, you will need to respond with either
FBWorld.allowConnection(); or
FBWorld.denyConnection();
The difference between being not being logged in and connecting and being not logged in has not been flushed out yet, as it's purely a facebook state. In terms of the app, you're either connected or not.
FBWorld provides you with these helper functions for debugging your application state
FBWorld.state();
FBWorld.setUid();
FBWorld.uid();
FBWorld.beingPromptedToLogin;
FBWorld.beingPromptedToConnect;
If you modify facebook-stub.js directly it will be overwritten by builder/concat. Modify src/ files only
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// App code being tested
FB.ui({method:'feed', etc:…}, function(){ … })
// test pseudo code
FBWorld.beingPromptedToShare; //=> false
FBWorld.beingPromptedToShareOptions; //=> null
FBWorld.beingPromptedToShareCallback; //=> null
// do whatever causes the above app code to be called
FBWorld.beingPromptedToLogin; //=> true
FBWorld.beingPromptedToShareOptions; //=> {method:'feed', etc:…}
FBWorld.beingPromptedToShareCallback; //=> function(){ … }
// simulate sharing
FBWorld.confirmSharePrompt();
// the callback is called here with a response stub containing a post id
FBWorld.beingPromptedToShare; //=> false
FBWorld.beingPromptedToShareOptions; //=> null
FBWorld.beingPromptedToShareCallback; //=> null
// OR
// do whatever causes the above app code to be called
FBWorld.beingPromptedToLogin; //=> true
FBWorld.beingPromptedToShareOptions; //=> {method:'feed', etc:…}
FBWorld.beingPromptedToShareCallback; //=> function(){ … }
// simulate sharing
FBWorld.cancelSharePrompt();
// the callback is called here with a response stub not containing a post id
FBWorld.beingPromptedToShare; //=> false
FBWorld.beingPromptedToShareOptions; //=> null
FBWorld.beingPromptedToShareCallback; //=> null
FAQs
Unknown package
We found that facebook-stub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.