summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/workers/parser/tests/framework.spec.js
blob: b503a81a57ef943e14dd341dda5891bb0cc9eee0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

// @flow

import { getSymbols } from "../getSymbols";
import { populateOriginalSource } from "./helpers";
import cases from "jest-in-case";

cases(
  "Parser.getFramework",
  ({ name, file, value }) => {
    const source = populateOriginalSource("frameworks/plainJavascript");
    const symbols = getSymbols(source.id);
    expect(symbols.framework).toBeUndefined();
  },
  [
    {
      name: "is undefined when no framework",
      file: "frameworks/plainJavascript",
      value: undefined,
    },
    {
      name: "does not get confused with angular (#6833)",
      file: "frameworks/angular1FalsePositive",
      value: undefined,
    },
    {
      name: "recognizes ES6 React component",
      file: "frameworks/reactComponent",
      value: "React",
    },
    {
      name: "recognizes ES5 React component",
      file: "frameworks/reactComponentEs5",
      value: "React",
    },
    {
      name: "recognizes Angular 1 module",
      file: "frameworks/angular1Module",
      value: "Angular",
    },
    {
      name: "recognizes declarative Vue file",
      file: "frameworks/vueFileDeclarative",
      value: "Vue",
    },
    {
      name: "recognizes component Vue file",
      file: "frameworks/vueFileComponent",
      value: "Vue",
    },
    {
      name: "recognizes the react library file",
      file: "framework/reactLibrary",
      value: "React",
    },
    {
      name: "recognizes the redux library file",
      file: "framework/reduxLibrary",
      value: "React",
    },
  ]
);