Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

uber / deck.gl / 13720

17 Sep 2019 - 4:53 coverage increased (+2.8%) to 82.714%
13720

Pull #3588

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
Try to fix examples
Pull Request #3588: Add JSON Tile3D examples to Playground

3390 of 4602 branches covered (73.66%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 1 file covered. (0.0%)

479 existing lines in 86 files now uncovered.

7161 of 8154 relevant lines covered (87.82%)

4294.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/modules/json/src/helpers/instantiate-class.js
1
import convertFunctions from './convert-functions';
2

3
// This attempts to instantate a class. Eiher as a class or as a react component
4
export function instantiateClass(type, props, configuration) {
5
  // Find the class
6
  const Class = configuration.classes[type];
1×
7
  const Component = configuration.reactComponents[type];
4×
8

9
  // Check that the class is in the configuration.
10
  if (!Class && !Component) {
1×
11
    const {log} = configuration; // eslint-disable-line
2×
12
    const stringProps = JSON.stringify(props, null, 0).slice(0, 40);
12×
13
    if (log) {
Branches [[2, 1]] missed. 12×
14
      log.warn(`JSON converter: No registered class of type ${type}(${stringProps}...)  `);
12×
15
    }
16
    return null;
1×
17
  }
18

19
  if (Class) {
Branches [[3, 1]] missed. 1×
20
    return instantiateJavaScriptClass(Class, props, configuration);
1×
21
  }
22

23
  return instantiateReactComponent(Component, props, configuration);
1×
24
}
25

26
function instantiateJavaScriptClass(Class, props, configuration) {
27
  if (configuration.preProcessClassProps) {
Branches [[4, 1]] missed. 1×
28
    props = configuration.preProcessClassProps(Class, props, configuration);
11×
29
  }
30

31
  props = convertFunctions(Class, props, configuration);
11×
32

UNCOV
33
  return new Class(props);
!
34
}
35

36
function instantiateReactComponent(Component, props, configuration) {
37
  const {React} = configuration;
11×
38
  const {children = []} = props;
Branches [[5, 0]] missed. 11×
39
  delete props.children;
11×
40
  if (configuration.preProcessClassProps) {
Branches [[6, 0], [6, 1]] missed. 11×
41
    props = configuration.preProcessClassProps(Component, props, configuration);
!
42
  }
43

44
  props = convertFunctions(Component, props, configuration);
!
45

46
  return React.createElement(Component, props, children);
!
47
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2019 Coveralls, LLC