Skip to content

Instantly share code, notes, and snippets.

@wingyplus
Created March 19, 2020 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wingyplus/0858a11f7ab2009c567d645900d442a6 to your computer and use it in GitHub Desktop.
Save wingyplus/0858a11f7ab2009c567d645900d442a6 to your computer and use it in GitHub Desktop.
LIFF wrapper with automatical replace when running under Cypress
/* eslint-disable no-undef */
// replaced liff when running in cypress sandbox
if (window.cy) {
console.log('liff: running in cypress sandbox')
window.liff = window.cy.liff
}
export default {
init() {
return new Promise((resolve, reject) =>
liff.init(
() => resolve(),
(err) => reject(err)
)
)
},
getProfile() {
return liff.getProfile()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment