<commit_before>/**
 * Copyright (c) 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

'use strict';

/* eslint-disable max-len */

let babel = require('babel-core');
let devDeclaration = require('../dev-declaration');

function transform(input) {
  return babel.transform(input, {
    plugins: ['syntax-flow', devDeclaration],
  }).code;
}

function compare(input, output) {
  var compiled = transform(input);
  expect(compiled).toEqual(output);
}

describe('dev-declaration', function() {

  // Babel currently compiles booleanTypeAnnotation to `bool`. Will be `boolean`
  // in the future.
  it('should replace calls', () => {
    compare(
`if (__DEV__) console.log();`,
`declare var __DEV__: bool;
if (__DEV__) console.log();`);
  });

});<commit_msg>[babel-preset-fbjs] fix dev-declaration plugin (#201)<commit_after>/**
 * Copyright (c) 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

'use strict';

/* eslint-disable max-len */

let babel = require('babel-core');
let devDeclaration = require('../dev-declaration');

function transform(input) {
  return babel.transform(input, {
    plugins: ['syntax-flow', devDeclaration],
  }).code;
}

function compare(input, output) {
  var compiled = transform(input);
  expect(compiled).toEqual(output);
}

describe('dev-declaration', function() {

  it('should replace calls', () => {
    compare(
`if (__DEV__) console.log();`,
`declare var __DEV__: boolean;
if (__DEV__) console.log();`);
  });

});
{'fraction_non_alphanumeric': 0.1441908713692946, 'fraction_numerical': 0.005705394190871369, 'mean_word_length': 4.185483870967742, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4824474', 'n_tokens_mistral': 589, 'n_tokens_neox': 562, 'n_words': 194}