Files
test-repo/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap
T

252 lines
5.3 KiB
Plaintext

exports[`test Bar.js 1`] = `
"var Bar = { x: 0 };
module.exports = Bar;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var Bar = { x: 0 };
module.exports = Bar;
"
`;
exports[`test copyProperties.js 1`] = `
"// @flow
let tests = [
// global
function() {
(copyProperties()); // error, unknown global
},
// annotation
function(copyProperties: Object$Assign) {
let result = {};
result.baz = false;
(copyProperties(
result,
{ foo: \'a\' },
{ bar: 123 }
): { foo: string, bar: number, baz: boolean });
},
// module from lib
function() {
const copyProperties = require(\'copyProperties\');
let x = { foo: \'a\' };
let y = { bar: 123 };
(copyProperties({}, x, y): { foo: string, bar: number });
},
// too few args
function(copyProperties: Object$Assign) {
copyProperties();
(copyProperties({ foo: \'a\' }): { foo: number }); // err, num !~> string
},
// passed as a function
function(copyProperties: Object$Assign) {
function x(cb: Function) {}
x(copyProperties);
}
];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
// global
// error, unknown global
// annotation
// module from lib
// too few args
// err, num !~> string
// passed as a function
let tests = [
function() {
copyProperties();
},
function(copyProperties: Object$Assign) {
let result = {};
result.baz = false;
(copyProperties(result, { foo: \"a\" }, { bar: 123 }): {
foo: string;
bar: number;
baz: boolean
});
},
function() {
const copyProperties = require(\"copyProperties\");
let x = { foo: \"a\" };
let y = { bar: 123 };
(copyProperties({}, x, y): { foo: string; bar: number });
},
function(copyProperties: Object$Assign) {
copyProperties();
(copyProperties({ foo: \"a\" }): { foo: number });
},
function(copyProperties: Object$Assign) {
function x(cb: Function) {}
x(copyProperties);
}
];
"
`;
exports[`test invariant.js 1`] = `
"/* @flow */
let tests = [
function() {
let x: ?string = null;
invariant(x, \'truthy only\'); // error, forgot to require invariant
},
function(invariant: Function) {
let x: ?string = null;
invariant(x);
(x: string);
}
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */
// error, forgot to require invariant
let tests = [
function() {
let x: ?string = null;
invariant(x, \"truthy only\");
},
function(invariant: Function) {
let x: ?string = null;
invariant(x);
(x: string);
}
];
"
`;
exports[`test lib.js 1`] = `
"declare module \"copyProperties\" {
declare var exports: Object$Assign;
}
declare module \"mergeInto\" {
declare var exports: $Facebookism$MergeInto;
}
declare module \"mixin\" {
declare var exports: $Facebookism$Mixin;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare module \"copyProperties\" {
declare var exports: Object$Assign;
}
declare module \"mergeInto\" {
declare var exports: $Facebookism$MergeInto;
}
declare module \"mixin\" {
declare var exports: $Facebookism$Mixin;
}
"
`;
exports[`test mergeInto.js 1`] = `
"// @flow
let tests = [
// global
function() {
(mergeInto()); // error, unknown global
},
// annotation
function(mergeInto: $Facebookism$MergeInto) {
let result = {};
result.baz = false;
(mergeInto(result, { foo: \'a\' }, { bar: 123 }): void);
(result: { foo: string, bar: number, baz: boolean });
},
// module from lib
function() {
const mergeInto = require(\'mergeInto\');
let result: { foo?: string, bar?: number, baz: boolean } = { baz: false };
(mergeInto(result, { foo: \'a\' }, { bar: 123 }): void);
},
// too few args
function(mergeInto: $Facebookism$MergeInto) {
mergeInto();
},
// passed as a function
function(mergeInto: $Facebookism$MergeInto) {
function x(cb: Function) {}
x(mergeInto);
}
];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
// global
// error, unknown global
// annotation
// module from lib
// too few args
// passed as a function
let tests = [
function() {
mergeInto();
},
function(mergeInto: $Facebookism$MergeInto) {
let result = {};
result.baz = false;
(mergeInto(result, { foo: \"a\" }, { bar: 123 }): void);
(result: { foo: string; bar: number; baz: boolean });
},
function() {
const mergeInto = require(\"mergeInto\");
let result: { foo?: string; bar?: number; baz: boolean } = { baz: false };
(mergeInto(result, { foo: \"a\" }, { bar: 123 }): void);
},
function(mergeInto: $Facebookism$MergeInto) {
mergeInto();
},
function(mergeInto: $Facebookism$MergeInto) {
function x(cb: Function) {}
x(mergeInto);
}
];
"
`;
exports[`test test.js 1`] = `
"var Bar = require(\'./Bar\');
var mixin = require(\'mixin\');
class Foo extends mixin(Bar) {
m() {
var x: string = this.x;
this.y = \"\";
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var Bar = require(\"./Bar\");
var mixin = require(\"mixin\");
class Foo extends mixin(Bar) {
m() {
var x: string = this.x;
this.y = \"\";
}
}
"
`;