Jest update v26.6.3 -> v29.5.1

Summary:
^

Basically, update Jest and fix any raised issues. Mainly:
- Update necessary dependencies
- Update snapshots
- `useFakeTimers` caused a few issues which meant that the way we hook into the performance object had to be tweaked. The main code change is: `//fbsource/xplat/sonar/desktop/scripts/jest-setup-after.tsx`
- `mocked` -> `jest.mocked`

Changelog: Update Jest to v29.5.1

Reviewed By: antonk52

Differential Revision: D46319818

fbshipit-source-id: d218ca8f7e43abac6b00844953ddeb7f4e1010a2
This commit is contained in:
Lorenzo Blasa
2023-05-31 14:19:29 -07:00
committed by Facebook GitHub Bot
parent 94cb8935b2
commit 6430403da0
40 changed files with 1721 additions and 1787 deletions

View File

@@ -50,8 +50,8 @@ test('it will merge equal rows', () => {
sendLogEntry(entry3);
expect(instance.rows.records()).toMatchInlineSnapshot(`
Array [
Object {
[
{
"app": "X",
"count": 1,
"date": 2021-01-28T17:15:12.859Z,
@@ -61,7 +61,7 @@ test('it will merge equal rows', () => {
"tid": 1,
"type": "error",
},
Object {
{
"app": "Y",
"count": 2,
"date": 2021-01-28T17:15:17.859Z,
@@ -71,7 +71,7 @@ test('it will merge equal rows', () => {
"tid": 3,
"type": "warn",
},
Object {
{
"app": "X",
"count": 1,
"date": 2021-01-28T17:15:12.859Z,
@@ -130,9 +130,9 @@ test('export / import plugin does work', async () => {
const data = await exportStateAsync();
expect(data).toMatchInlineSnapshot(`
Object {
"logs": Array [
Object {
{
"logs": [
{
"app": "X",
"count": 1,
"date": 2021-01-28T17:15:12.859Z,
@@ -142,7 +142,7 @@ test('export / import plugin does work', async () => {
"tid": 1,
"type": "error",
},
Object {
{
"app": "Y",
"count": 1,
"date": 2021-01-28T17:15:17.859Z,

View File

@@ -47,11 +47,11 @@ test('Reducer correctly adds initial chunk', () => {
});
expect(instance.partialResponses.get()['1']).toMatchInlineSnapshot(`
Object {
"followupChunks": Object {},
"initialResponse": Object {
{
"followupChunks": {},
"initialResponse": {
"data": "hello",
"headers": Array [],
"headers": [],
"id": "1",
"index": 0,
"insights": null,
@@ -76,8 +76,8 @@ test('Reducer correctly adds followup chunk', () => {
data: 'hello',
});
expect(instance.partialResponses.get()['1']).toMatchInlineSnapshot(`
Object {
"followupChunks": Object {
{
"followupChunks": {
"1": "hello",
},
}
@@ -113,13 +113,13 @@ test('Reducer correctly combines initial response and followup chunk', () => {
totalChunks: 2,
});
expect(instance.partialResponses.get()).toMatchInlineSnapshot(`
Object {
"1": Object {
"followupChunks": Object {},
"initialResponse": Object {
{
"1": {
"followupChunks": {},
"initialResponse": {
"data": "aGVs",
"headers": Array [
Object {
"headers": [
{
"key": "Content-Type",
"value": "text/plain",
},

View File

@@ -75,13 +75,13 @@ test('Can handle custom headers', async () => {
// verify internal storage
expect(instance.columns.get().slice(-2)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"key": "request_header_test-header",
"title": "test-header (request)",
"width": 200,
},
Object {
{
"key": "response_header_second-test-header",
"title": "second-test-header (response)",
"width": 200,
@@ -138,13 +138,13 @@ test('Can handle custom headers', async () => {
// verify internal storage
expect(instance2.columns.get().slice(-2)).toMatchInlineSnapshot(`
Array [
Object {
[
{
"key": "request_header_test-header",
"title": "test-header (request)",
"width": 200,
},
Object {
{
"key": "response_header_second-test-header",
"title": "second-test-header (response)",
"width": 200,

View File

@@ -28,13 +28,13 @@ test('It can store rows', () => {
});
expect(instance.rows.get()).toMatchInlineSnapshot(`
Object {
"1": Object {
{
"1": {
"id": 1,
"title": "Dolphin",
"url": "http://dolphin.png",
},
"2": Object {
"2": {
"id": 2,
"title": "Turtle",
"url": "http://turtle.png",

View File

@@ -37,16 +37,16 @@ test('general plugin logic testing', async () => {
await sleep(1000);
expect(onSend).toBeCalledWith('getAllSharedPreferences', {});
expect(instance.sharedPreferences.get()).toMatchInlineSnapshot(`
Object {
"other_sample": Object {
"changesList": Array [],
"preferences": Object {
{
"other_sample": {
"changesList": [],
"preferences": {
"SomeKey": 1337,
},
},
"sample": Object {
"changesList": Array [],
"preferences": Object {
"sample": {
"changesList": [],
"preferences": {
"Hello": "world",
},
},
@@ -77,16 +77,16 @@ test('general plugin logic testing', async () => {
5555,
);
expect(instance.sharedPreferences.get()).toMatchInlineSnapshot(`
Object {
"other_sample": Object {
"changesList": Array [],
"preferences": Object {
{
"other_sample": {
"changesList": [],
"preferences": {
"SomeKey": 5555,
},
},
"sample": Object {
"changesList": Array [
Object {
"sample": {
"changesList": [
{
"deleted": false,
"name": "SomeKey",
"preferences": "sample",
@@ -94,7 +94,7 @@ test('general plugin logic testing', async () => {
"value": 5555,
},
],
"preferences": Object {
"preferences": {
"Hello": "world",
"SomeKey": 5555,
},
@@ -120,20 +120,20 @@ test('general plugin logic testing', async () => {
instance.sharedPreferences.get().sample.preferences.SomeKey,
).toBeUndefined();
expect(instance.sharedPreferences.get()).toMatchInlineSnapshot(`
Object {
"other_sample": Object {
"changesList": Array [],
"preferences": Object {},
{
"other_sample": {
"changesList": [],
"preferences": {},
},
"sample": Object {
"changesList": Array [
Object {
"sample": {
"changesList": [
{
"deleted": true,
"name": "SomeKey",
"preferences": "sample",
"time": 2,
},
Object {
{
"deleted": false,
"name": "SomeKey",
"preferences": "sample",
@@ -141,7 +141,7 @@ test('general plugin logic testing', async () => {
"value": 5555,
},
],
"preferences": Object {
"preferences": {
"Hello": "world",
},
},