Deven Bansod 8b57a3e3b9 Migrate a few packages' tests to use Jest Expect (see below)
* Migrate the following packages' tests:
    * babel-helper-annotate-as-pure
    * babel-helper-module-imports
    * babel-helper-transform-fixture-test-runner
    * babel-highlight
    * babel-node
    * babel-plugin-transform-modules-commonjs
    * babel-preset-env-standalone
    * babel-preset-env
    * babel-preset-es2015
    * babel-preset-react
    * babel-standalone
    * babel-template
    * babel-traverse
    * babel-types
2018-03-24 16:22:10 +05:30

50 lines
1.4 KiB
JavaScript

"use strict";
const defaults = require("../lib/defaults.js");
const {
getPlatformSpecificDefaultFor,
getOptionSpecificExcludesFor,
} = defaults;
describe("defaults", () => {
describe("getPlatformSpecificDefaultFor", () => {
it("should return web polyfills for non-`node` platform", () => {
const defaultWebIncludesForChromeAndNode = getPlatformSpecificDefaultFor({
chrome: "63",
node: "8",
});
expect(defaultWebIncludesForChromeAndNode).toEqual([
"web.timers",
"web.immediate",
"web.dom.iterable",
]);
});
it("shouldn't return web polyfills for node platform", () => {
const defaultWebIncludesForChromeAndNode = getPlatformSpecificDefaultFor({
node: "8",
});
expect(defaultWebIncludesForChromeAndNode).toBeNull();
});
});
describe("getOptionSpecificExcludesFor", () => {
it("should return correct excludes for `loose` mode", () => {
const defaultWebIncludesForChromeAndNode = getOptionSpecificExcludesFor({
loose: true,
});
expect(defaultWebIncludesForChromeAndNode).toEqual([
"transform-typeof-symbol",
]);
});
it("shouldn't return excludes for non-`loose` mode", () => {
const defaultWebIncludesForChromeAndNode = getOptionSpecificExcludesFor({
loose: false,
});
expect(defaultWebIncludesForChromeAndNode).toBeNull();
});
});
});