Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function revenueTests() {
//* constructor
(new Revenue(): Revenue);
const r: Revenue = new Revenue();
//* setProductId
r.setProductId('pid');
// $ExpectError: setProductId only accepts strings
r.setProductId(5);
// $ExpectError: setProductId only accepts strings
r.setProductId();
//* setQuantity
r.setQuantity(5);
r.setQuantity();
// @flow
/* eslint-disable no-unused-vars, no-undef, no-console */
import amplitude, { Identify, Revenue } from 'amplitude-js';
import type { AmplitudeClient } from 'amplitude-js';
/**
* Common instances
*/
const client = amplitude.getInstance();
const identify = new Identify();
const revenue = new Revenue();
const callback = (responseCode: number, responseBody: string) => void 0;
/**
* ALL THE TESTS START FROM HERE
*/
function getInstanceTest() {
(amplitude.getInstance(): AmplitudeClient);
(amplitude.getInstance('name'): AmplitudeClient);
// $ExpectError: getInstance only accepts strings
amplitude.getInstance(5);
// $ExpectError: getInstance only accepts strings
amplitude.getInstance(new Date());
}
function revenueTests() {
//* constructor
(new Revenue(): Revenue);
const r: Revenue = new Revenue();
//* setProductId
r.setProductId('pid');
// $ExpectError: setProductId only accepts strings
r.setProductId(5);
// $ExpectError: setProductId only accepts strings
r.setProductId();
//* setQuantity
r.setQuantity(5);
r.setQuantity();
// $ExpectError: setProductId only accepts numbers
r.setQuantity('foo');