def test_rest_error(): with pytest.raises(p.ParseError) as e: get_default_export(data_dir / "errors/rest.dn.js") assert str(e.value).splitlines()[1:] == dedent(""" must be of type: { ...foo, _______^ """).strip().splitlines()
def test_scope_error(): with pytest.raises(p.ParseError) as e: get_default_export(data_dir / "errors/scope.dn.js") assert str(e.value).splitlines()[1:] == dedent(""" variable bar is not in scope export default bar _______________^ """).strip().splitlines()
def test_parser_add_assignments_reference_and_rest(): actual = get_default_export(data_dir / "rest.dn.js") expected = { "key": ["item0", "item1", 3.14, 42, 43, True, { "bar": [42, 43] }], "bar": [42, 43], } assert actual == expected
def test_imported_functions(): actual = get_default_export(data_dir / "functionCall.dn.js") expected = {"hello": 42} assert actual == expected
def test_imports(): actual = get_default_export(data_dir / "thisImports.dn.js") expected = {"foo": ["DEFAULT", [{"A": 1}], "B"]} assert actual == expected