Skip to content

Commit

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

Summary:
Pull Request resolved: facebook#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

Differential Revision: D45368748

fbshipit-source-id: c115b5615a03e4c91d0217cf76502bc154a29f81
  • Loading branch information
hoxyq authored and facebook-github-bot committed Apr 27, 2023
1 parent b0cf746 commit 0918cd5
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 0918cd5

Please sign in to comment.