Skip to content

Commit

Permalink
RN: Make hermes-inspector-msggen tests visible for jest matcher (#3…
Browse files Browse the repository at this point in the history
…7131)

Summary:
Pull Request resolved: #37131

Changelog: [Internal]

Looks like all this time jest was not running these tests, because their file names are not matching the
https://www.internalfb.com/code/fbsource/[1e8a1b307ffd]/xplat/js/react-native-github/jest.config.js?lines=30

- Renamed tests to kebab-case
- Some of them were failing, now updated

Reviewed By: motiz88

Differential Revision: D45368748

fbshipit-source-id: a00e6ebb8f37363516b1af79d6251fbceb0afb68
  • Loading branch information
hoxyq authored and facebook-github-bot committed May 9, 2023
1 parent 8132500 commit e540d05
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ beforeEach(() => {

// checks id1 occurs after id2 in arr
function expectOccursAfter(arr, id1, id2) {
let idx1 = arr.indexOf(id1);
let idx2 = arr.indexOf(id2);
const idx1 = arr.indexOf(id1);
const idx2 = arr.indexOf(id2);

expect(idx1).not.toBe(-1);
expect(idx2).not.toBe(-1);
Expand All @@ -35,18 +35,20 @@ function expectOccursAfter(arr, id1, id2) {

test('detects cycle', () => {
graph.addEdge('C2', 'A1');
expect(() => graph.traverse(['A2'])).toThrow(/^Not a DAG/);

const {cycles} = graph.traverse(['A2']);
expect(cycles).toContainEqual({from: 'A1', to: 'B1'});
});

test('checks for presence of root', () => {
expect(() => graph.traverse(['A1', 'NX'])).toThrow(/^No node/);
});

test('traverses partial graph', () => {
let ids = graph.traverse(['B1', 'A3']);
const {nodes: ids} = graph.traverse(['B1', 'A3']);

// Check that expected nodes are there
let sortedIds = ids.slice().sort();
const sortedIds = ids.slice().sort();
expect(sortedIds).toEqual(['A3', 'B1', 'B2', 'C1', 'C2', 'C3']);

// Check that the result is topologically sorted
Expand All @@ -59,10 +61,10 @@ test('traverses partial graph', () => {
});

test('traverses complete graph', () => {
let ids = graph.traverse(['A1', 'A2', 'A3']);
const {nodes: ids} = graph.traverse(['A1', 'A2', 'A3']);

// Check that expected nodes are there
let sortedIds = ids.slice().sort();
const sortedIds = ids.slice().sort();
expect(sortedIds).toEqual(['A1', 'A2', 'A3', 'B1', 'B2', 'C1', 'C2', 'C3']);

// Check that the result is topologically sorted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ test('emits type decl', () => {
expectCodeIsEqual(stream.get(), `
struct debugger::Location : public Serializable {
Location() = default;
Location(Location&&) = default;
Location(const Location&) = delete;
explicit Location(const folly::dynamic &obj);
folly::dynamic toDynamic() const override;
Location& operator=(const Location&) = delete;
Location& operator=(Location&&) = default;
runtime::ScriptId scriptId{};
int lineNumber{};
Expand Down

0 comments on commit e540d05

Please sign in to comment.