def test_get_jsmods_require(): argument = { "signalsToCollect": [ 30000, 30001, 30003, 30004, 30005, 30002, 30007, 30008, 30009, ] } data = [ ["BanzaiODS"], [ "TuringClientSignalCollectionTrigger", "startStaticSignalCollection", [], [argument], ], ] assert get_jsmods_require(data) == { "BanzaiODS": [], "TuringClientSignalCollectionTrigger.startStaticSignalCollection": [argument], }
def test_get_jsmods_require_version_specifier(): data = [ ["DimensionTracking@1234"], ["CavalryLoggerImpl@2345", "startInstrumentation", [], []], ] assert get_jsmods_require(data) == { "DimensionTracking": [], "CavalryLoggerImpl.startInstrumentation": [], }
def test_get_jsmods_require_get_image_url(): data = [ [ "ServerRedirect", "redirectPageTo", [], [ "https://scontent-arn2-1.xx.fbcdn.net/v/image.png&dl=1", False, False ], ], ["TuringClientSignalCollectionTrigger", "...", [], [...]], ["TuringClientSignalCollectionTrigger", "retrieveSignals", [], [...]], ["BanzaiODS"], ["BanzaiScuba"], ] url = "https://scontent-arn2-1.xx.fbcdn.net/v/image.png&dl=1" assert get_jsmods_require(data)["ServerRedirect.redirectPageTo"][0] == url
def test_get_jsmods_require_get_image_url(): data = { "__ar": 1, "payload": None, "jsmods": { "require": [ [ "ServerRedirect", "redirectPageTo", [], [ "https://scontent-arn2-1.xx.fbcdn.net/v/image.png&dl=1", False, False, ], ], ["TuringClientSignalCollectionTrigger", ..., [], ...], [ "TuringClientSignalCollectionTrigger", "retrieveSignals", [], ... ], ["BanzaiODS"], ["BanzaiScuba"], ], "define": ..., }, "js":..., "css":..., "bootloadable":..., "resource_map":..., "ixData": {}, "bxData": {}, "gkxData":..., "qexData": {}, "lid": "123", } url = "https://scontent-arn2-1.xx.fbcdn.net/v/image.png&dl=1" assert get_jsmods_require(data, 3) == url