Skip to content

Commit

Permalink
Merge pull request #66 from bruceharrison1984/even-more-tests
Browse files Browse the repository at this point in the history
Even more tests
  • Loading branch information
bruceharrison1984 authored Nov 1, 2022
2 parents 66825ef + f5b68f6 commit 903899b
Show file tree
Hide file tree
Showing 41 changed files with 1,089 additions and 303 deletions.
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
npm run test
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"jest.jestCommandLine": "npm run test --",
"jest.jestCommandLine": "npm run test -- --",
"cSpell.words": ["Schedulely"]
}
110 changes: 55 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
],
"scripts": {
"build": "turbo run build --no-daemon",
"barrels": "turbo run barrels --no-daemon",
"build-ladle": "turbo run build-ladle --no-daemon",
"rollup": "turbo run rollup --no-daemon",
"ssr-test": "turbo run ssr-test --no-daemon",
Expand Down Expand Up @@ -54,7 +55,7 @@
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-ts": "^3.0.2",
"sass": "^1.55.0",
"turbo": "1.6.1",
"turbo": "1.6.2",
"typescript": "^4.8.3"
},
"engines": {
Expand Down
73 changes: 1 addition & 72 deletions packages/Schedulely/__tests__/dateAdapters/dateAdapter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getIsTodayTestCases,
getMonthNameFromDateTestCases,
getYearFromDateTestCases,
} from './dateAdapter.testHelper';
} from '../testHelpers/dateAdapter.testHelper';

/**
* Additional adapters should just be added to this array
Expand Down Expand Up @@ -163,77 +163,6 @@ describe('Date Adapter', () => {
);
});

describe('getGridEndIndex', () => {
it.each<{ eventEnd: Date; endOfWeek: Date; expected: number }>([
{
eventEnd: new Date(2022, 1, 11),
endOfWeek: new Date(2022, 1, 12),
expected: 7,
},
{
// event ends after end of week
eventEnd: new Date(2022, 1, 13),
endOfWeek: new Date(2022, 1, 12),
expected: 8,
},
{
eventEnd: new Date(2022, 1, 9),
endOfWeek: new Date(2022, 1, 12),
expected: 5,
},
{
// event ends on Sunday
eventEnd: new Date(2021, 8, 26),
endOfWeek: new Date(2021, 9, 2),
expected: 2,
},
{
// event that starts and ends on Sunday
eventEnd: new Date(2022, 0, 2),
endOfWeek: new Date(2022, 0, 8),
expected: 2,
},
])(
'$eventEnd with $endOfWeek returns $expected',
({ eventEnd, endOfWeek, expected }) => {
const result = adapter.getGridEndIndex(eventEnd, endOfWeek);
expect(result).toBe(expected);
}
);
});

describe('getGridStartIndex', () => {
it.each<{ eventStart: Date; startOfWeek: Date; expected: number }>([
{
eventStart: new Date(2022, 1, 7),
startOfWeek: new Date(2022, 1, 6),
expected: 2,
},
{
eventStart: new Date(2022, 1, 9),
startOfWeek: new Date(2022, 1, 6),
expected: 4,
},
{
eventStart: new Date(2022, 3, 10),
startOfWeek: new Date(2022, 3, 10),
expected: 1,
},
{
// event that starts and ends on Sunday
eventStart: new Date(2022, 0, 2),
startOfWeek: new Date(2022, 0, 2),
expected: 1,
},
])(
'$eventStart with $startOfWeek returns $expected',
({ eventStart, startOfWeek, expected }) => {
const result = adapter.getGridStartIndex(eventStart, startOfWeek);
expect(result).toBe(expected);
}
);
});

describe('isEventInWeek', () => {
it.each<{
message: string;
Expand Down
Loading

0 comments on commit 903899b

Please sign in to comment.