Skip to content

Commit

Permalink
fix run test lib tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dd-spells committed Mar 19, 2024
1 parent ee2deab commit 02b4f87
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/commands/synthetics/__tests__/run-tests-lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
getApiTest,
getAxiosHttpError,
getMobileTest,
getMockAppUploadReporter,
MOBILE_PRESIGNED_URLS_PAYLOAD,
mockReporter,
mockTestTriggerResponse,
Expand Down Expand Up @@ -50,7 +51,7 @@ describe('run-test', () => {
jest.spyOn(api, 'getApiHelper').mockImplementation(() => ({} as any))

await expect(
runTests.executeTests(mockReporter, {
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {
...ciConfig,
global: userConfigOverride,
publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'],
Expand All @@ -63,6 +64,7 @@ describe('run-test', () => {
expect.objectContaining({id: 'bbb-bbb-bbb', config: userConfigOverride}),
]),
expect.anything(),
expect.anything(),
false,
false,
false
Expand Down Expand Up @@ -100,7 +102,7 @@ describe('run-test', () => {

jest.spyOn(api, 'getApiHelper').mockImplementation(() => ({} as any))
await expect(
runTests.executeTests(mockReporter, {
runTests.executeTests( mockReporter, getMockAppUploadReporter(), {
...ciConfig,
...partialCIConfig,
publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'],
Expand All @@ -113,6 +115,7 @@ describe('run-test', () => {
expect.objectContaining({id: 'bbb-bbb-bbb', config: expectedOverriddenConfig}),
]),
expect.anything(),
expect.anything(),
false,
false,
false
Expand All @@ -134,7 +137,7 @@ describe('run-test', () => {

jest.spyOn(api, 'getApiHelper').mockImplementation(() => ({} as any))
await expect(
runTests.executeTests(mockReporter, {
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {
...ciConfig,
global: configOverride,
publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'],
Expand All @@ -147,6 +150,7 @@ describe('run-test', () => {
expect.objectContaining({id: 'bbb-bbb-bbb', config: configOverride}),
]),
expect.anything(),
expect.anything(),
false,
false,
false
Expand All @@ -169,7 +173,7 @@ describe('run-test', () => {
jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)

await expect(
runTests.executeTests(mockReporter, {
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {
...ciConfig,
global: configOverride,
publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'],
Expand All @@ -183,6 +187,7 @@ describe('run-test', () => {
expect.objectContaining({id: 'bbb-bbb-bbb', config: configOverride}),
]),
expect.anything(),
expect.anything(),
false,
false,
true
Expand Down Expand Up @@ -215,7 +220,7 @@ describe('run-test', () => {
}

jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await runTests.executeTests(mockReporter, {
await runTests.executeTests(mockReporter, getMockAppUploadReporter(), {
...ciConfig,
failOnCriticalErrors: true,
publicIds: ['123-456-789'],
Expand All @@ -239,7 +244,7 @@ describe('run-test', () => {
}
jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await expect(
runTests.executeTests(mockReporter, {...ciConfig, testSearchQuery: 'a-search-query', tunnel: true})
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {...ciConfig, testSearchQuery: 'a-search-query', tunnel: true})
).rejects.toThrow(new CriticalError(error, 'Server Error'))
})

Expand All @@ -251,7 +256,7 @@ describe('run-test', () => {
}
jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await expect(
runTests.executeTests(mockReporter, {...ciConfig, publicIds: ['aaa-aaa-aaa'], tunnel: true})
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {...ciConfig, publicIds: ['aaa-aaa-aaa'], tunnel: true})
).rejects.toThrow(
new CriticalError(
error,
Expand All @@ -278,7 +283,7 @@ describe('run-test', () => {

jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await expect(
runTests.executeTests(mockReporter, {...ciConfig, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true})
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {...ciConfig, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true})
).rejects.toThrow(new CriticalError('UNAVAILABLE_TUNNEL_CONFIG', 'Server Error'))
})

Expand All @@ -303,7 +308,7 @@ describe('run-test', () => {

jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await expect(
runTests.executeTests(mockReporter, {
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {
...ciConfig,
global: {mobileApplicationVersionFilePath: 'filePath'},
publicIds: [mobileTest.public_id],
Expand Down Expand Up @@ -335,7 +340,7 @@ describe('run-test', () => {

jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await expect(
runTests.executeTests(mockReporter, {
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {
...ciConfig,
global: {mobileApplicationVersionFilePath: 'filePath'},
publicIds: [mobileTest.public_id],
Expand Down Expand Up @@ -366,7 +371,7 @@ describe('run-test', () => {

jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await expect(
runTests.executeTests(mockReporter, {...ciConfig, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true})
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {...ciConfig, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true})
).rejects.toThrow(
new CriticalError(
'TRIGGER_TESTS_FAILED',
Expand Down Expand Up @@ -413,7 +418,7 @@ describe('run-test', () => {

jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper as any)
await expect(
runTests.executeTests(mockReporter, {
runTests.executeTests(mockReporter, getMockAppUploadReporter(), {
...ciConfig,
failOnCriticalErrors: true,
publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'],
Expand Down Expand Up @@ -454,6 +459,7 @@ describe('run-test', () => {
const runConfig = {apiKey: 'apiKey', appKey: 'appKey'}
await runTests.executeWithDetails(runConfig, {})
expect(runTests.executeTests).toHaveBeenCalledWith(
expect.anything(),
expect.anything(),
expect.objectContaining(runConfig),
undefined
Expand All @@ -464,6 +470,7 @@ describe('run-test', () => {
const suites = [{content: {tests: []}}]
await runTests.executeWithDetails({}, {suites})
expect(runTests.executeTests).toHaveBeenCalledWith(
expect.anything(),
expect.anything(),
expect.objectContaining({files: []}),
suites
Expand Down

0 comments on commit 02b4f87

Please sign in to comment.