Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,163 changes: 1,211 additions & 4,952 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@commitlint/cli": "^13.0.0",
"@commitlint/config-conventional": "^13.0.0",
"@types/chai": "^4.2.12",
"@types/jest": "^26.0.13",
"@types/jest": "^27.0.0",
"@types/jest-diff": "^24.3.0",
"@types/jest-matcher-utils": "^25.1.0",
"@types/mockdate": "^2.0.0",
Expand All @@ -61,18 +61,18 @@
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"husky": "^4.0.7",
"jest": "^26.0.0",
"jest": "^27.0.0",
"mockdate": "^3.0.0",
"prettier": "^2.0.0",
"ts-jest": "^26.4.4",
"ts-jest": "^27.0.0",
"ts-node": "^10.0.0",
"typescript": "^4.0.5"
},
"dependencies": {
"aws-sdk": "^2.678.0",
"axios": "^0.21.0",
"filter-obj": "^2.0.1",
"jest-diff": "^26.0.0",
"jest-diff": "^27.0.0",
"uuid": "^8.0.0"
},
"engines": {
Expand Down
8 changes: 6 additions & 2 deletions src/common/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { epochDateMinusHours, sleep, verifyProps } from './';

jest.useFakeTimers();

describe('common index', () => {
afterEach(() => {
jest.useRealTimers();
});

describe('sleep', () => {
test('should call setTimeout', async () => {
// TODO: Use modern timers once https://github.com/facebook/jest/issues/11713 is resolved
jest.useFakeTimers('legacy');
const promise = sleep(1000);
jest.runAllTimers();

Expand Down
11 changes: 4 additions & 7 deletions src/jest/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { toReturnResponse } from './api';
jest.mock('../common');
jest.mock('../utils/api');
jest.spyOn(console, 'error');
jest.mock('jest-diff', () => ({
__esModule: true,
default: jest.fn(),
}));
jest.mock('jest-diff');

describe('api matchers', () => {
describe('toReturnResponse', () => {
Expand Down Expand Up @@ -70,7 +67,7 @@ describe('api matchers', () => {
});

test('should not pass on response not matching', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = 'diffString';
diff.mockReturnValue(diffString);

Expand Down Expand Up @@ -101,7 +98,7 @@ describe('api matchers', () => {
});

test('should not pass on getItem item not matching empty diffString', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = '';
diff.mockReturnValue(diffString);

Expand Down Expand Up @@ -131,7 +128,7 @@ describe('api matchers', () => {
});

test('should pass on getItem item matching', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');

matcherUtils.equals.mockReturnValue(true);

Expand Down
2 changes: 1 addition & 1 deletion src/jest/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import diff from 'jest-diff';
import { diff } from 'jest-diff';
import { EOL } from 'os';
import { verifyProps } from '../common';
import { expectedProps, IApiProps, IExpectedResponse } from '../common/api';
Expand Down
11 changes: 4 additions & 7 deletions src/jest/dynamoDb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import { toHaveItem } from './dynamoDb';
jest.mock('../common');
jest.mock('../utils/dynamoDb');
jest.spyOn(console, 'error');
jest.mock('jest-diff', () => ({
__esModule: true,
default: jest.fn(),
}));
jest.mock('jest-diff');

describe('dynamoDb matchers', () => {
describe('toHaveItem', () => {
Expand Down Expand Up @@ -89,7 +86,7 @@ describe('dynamoDb matchers', () => {
});

test('should not pass on getItem item not matching', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = 'diffString';
diff.mockReturnValue(diffString);

Expand Down Expand Up @@ -121,7 +118,7 @@ describe('dynamoDb matchers', () => {
});

test('should not pass on getItem item not matching empty diffString', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = '';
diff.mockReturnValue(diffString);

Expand Down Expand Up @@ -154,7 +151,7 @@ describe('dynamoDb matchers', () => {
});

test('should pass on getItem item matching', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');

matcherUtils.equals.mockReturnValue(true);

Expand Down
2 changes: 1 addition & 1 deletion src/jest/dynamoDb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import diff from 'jest-diff';
import { diff } from 'jest-diff';
import { EOL } from 'os';
import { verifyProps } from '../common';
import {
Expand Down
11 changes: 4 additions & 7 deletions src/jest/s3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import { toHaveObject } from './s3';
jest.mock('../common');
jest.mock('../utils/s3');
jest.spyOn(console, 'error');
jest.mock('jest-diff', () => ({
__esModule: true,
default: jest.fn(),
}));
jest.mock('jest-diff');

describe('s3 matchers', () => {
describe('toHaveObject', () => {
Expand Down Expand Up @@ -97,7 +94,7 @@ describe('s3 matchers', () => {
});

test('should not pass on getObject buffer not matching', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = 'diffString';
diff.mockReturnValue(diffString);

Expand Down Expand Up @@ -131,7 +128,7 @@ describe('s3 matchers', () => {
});

test('should not pass on getObject buffer not matching empty diffString', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = '';
diff.mockReturnValue(diffString);

Expand All @@ -158,7 +155,7 @@ describe('s3 matchers', () => {
});

test('should pass on getObject buffer matching', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');

matcherUtils.equals.mockReturnValue(true);

Expand Down
2 changes: 1 addition & 1 deletion src/jest/s3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import diff from 'jest-diff';
import { diff } from 'jest-diff';
import { EOL } from 'os';
import { verifyProps } from '../common';
import { expectedProps, IS3Props } from '../common/s3';
Expand Down
11 changes: 4 additions & 7 deletions src/jest/stepFunctions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import { toBeAtState, toHaveState } from './stepFunctions';
jest.mock('../common');
jest.mock('../utils/stepFunctions');
jest.spyOn(console, 'error');
jest.mock('jest-diff', () => ({
__esModule: true,
default: jest.fn(),
}));
jest.mock('jest-diff');

describe('stepFunctions matchers', () => {
const matcherUtils = {
Expand Down Expand Up @@ -63,7 +60,7 @@ describe('stepFunctions matchers', () => {
});

test('should not pass when wrong state', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = 'diffString';
diff.mockReturnValue(diffString);

Expand Down Expand Up @@ -98,7 +95,7 @@ describe('stepFunctions matchers', () => {
});

test('should not pass when wrong state empty diffString', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const diffString = '';
diff.mockReturnValue(diffString);

Expand All @@ -120,7 +117,7 @@ describe('stepFunctions matchers', () => {
});

test('should pass when correct state', async () => {
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');

matcherUtils.equals.mockReturnValue(true);

Expand Down
2 changes: 1 addition & 1 deletion src/jest/stepFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import diff from 'jest-diff';
import { diff } from 'jest-diff';
import { EOL } from 'os';
import { verifyProps } from '../common';
import { expectedProps, IStepFunctionsProps } from '../common/stepFunctions';
Expand Down