Skip to content

Commit

Permalink
refactor: plugin unit test and cardfilter test date issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-Dabade committed May 30, 2024
1 parent 0b9b0cd commit b482512
Show file tree
Hide file tree
Showing 9 changed files with 4,227 additions and 8,888 deletions.
13,079 changes: 4,207 additions & 8,872 deletions mattermost-plugin/webapp/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions mattermost-plugin/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"imagemin-svgo": "^10.0.1",
"imagemin-webp": "7.0.0",
"isomorphic-fetch": "3.0.0",
"jest": "29.5.0",
"jest": "27.5.1",
"jest-canvas-mock": "2.4.0",
"jest-junit": "15.0.0",
"jest-mock": "27.5.1",
Expand All @@ -88,8 +88,8 @@
"glob-parent": "6.0.2",
"marked": ">=4.0.12",
"mattermost-redux": "5.33.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "^5.20.0",
"react-redux": "8.0.5",
"react-router-dom": "^5.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports[`components/rhsChannelBoardItem render board 1`] = `
<div
class="date"
>
Last update at: July 08, 2022, 8:10 PM
Last update at: July 09, 2022 at 1:40 AM
</div>
</div>
</div>
Expand Down Expand Up @@ -168,7 +168,7 @@ exports[`components/rhsChannelBoardItem render board with menu open 1`] = `
<div
class="date"
>
Last update at: July 08, 2022, 8:10 PM
Last update at: July 09, 2022 at 1:40 AM
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ exports[`components/rhsChannelBoards renders the RHS for channel boards 1`] = `
<div
class="date"
>
Last update at: July 08, 2022, 8:10 PM
Last update at: July 09, 2022 at 1:40 AM
</div>
</div>
<div
Expand Down Expand Up @@ -100,7 +100,7 @@ exports[`components/rhsChannelBoards renders the RHS for channel boards 1`] = `
<div
class="date"
>
Last update at: July 08, 2022, 8:10 PM
Last update at: July 09, 2022 at 1:40 AM
</div>
</div>
</div>
Expand Down Expand Up @@ -162,7 +162,7 @@ exports[`components/rhsChannelBoards renders the RHS for channel boards, no add
<div
class="date"
>
Last update at: July 08, 2022, 8:10 PM
Last update at: July 09, 2022 at 1:40 AM
</div>
</div>
<div
Expand Down Expand Up @@ -198,7 +198,7 @@ exports[`components/rhsChannelBoards renders the RHS for channel boards, no add
<div
class="date"
>
Last update at: July 08, 2022, 8:10 PM
Last update at: July 09, 2022 at 1:40 AM
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports[`components/boardsUnfurl/BoardsUnfurl renders normally 1`] = `
<span
class="post-preview__time"
>
Updated January 01, 1970, 12:00 AM
Updated January 01, 1970 at 5:30 AM
</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion mattermost-plugin/webapp/tests/setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// This won't exist locally when running in CI
// eslint-disable-next-line no-process-env
if (!process.env.CI) {
require('mattermost-webapp/tests/setup')
require('webapp/tests/setup')
}
4 changes: 2 additions & 2 deletions webapp/package-lock.json

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

4 changes: 2 additions & 2 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
"html-webpack-plugin": "^5.5.0",
"image-webpack-loader": "^8.1.0",
"isomorphic-fetch": "^3.0.0",
"jest": "^27.5.1",
"jest-mock": "^27.5.1",
"jest": "27.5.1",
"jest-mock": "27.5.1",
"prettier": "^2.6.1",
"redux-mock-store": "^1.5.4",
"sass": "^1.49.9",
Expand Down
6 changes: 5 additions & 1 deletion webapp/src/cardFilter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ describe('src/cardFilter', () => {
card1.id = '1'
card1.title = 'card1'
card1.fields.properties.propertyId = 'Status'

card1.createAt = new Date('December 7, 2023').getTime()
card1.updateAt = new Date('December 7, 2023').getTime()
card1.deleteAt = new Date('December 7, 2023').getTime()
const filterClause = createFilterClause({propertyId: 'propertyId', condition: 'isNotEmpty', values: ['Status']})

describe('verify isClauseMet method', () => {
Expand Down Expand Up @@ -336,7 +340,7 @@ describe('src/cardFilter', () => {

describe('verify isClauseMet method - (createdTime) date property', () => {
const createDate = new Date(card1.createAt)
const checkDate = Date.UTC(createDate.getFullYear(), createDate.getMonth(), createDate.getDate(), 12)
const checkDate = Date.UTC(createDate.getFullYear(), createDate.getMonth(), createDate.getDate(), createDate.getHours(), createDate.getMinutes(), createDate.getSeconds(), createDate.getMilliseconds())
const checkDayBefore = checkDate - dayMillis
const checkDayAfter = checkDate + dayMillis

Expand Down

0 comments on commit b482512

Please sign in to comment.