Skip to content

Commit

Permalink
fix banner tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Dec 17, 2024
1 parent afe65f6 commit 7a153eb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 27 deletions.
60 changes: 36 additions & 24 deletions test/unit/middleware/datasetOverview.middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ describe('Dataset Overview Middleware', () => {
it('should set notice for due dataset', () => {
const reqWithDataset = {
...req,
dataset: {
dataset: 'mock-dataset',
startDate: '2020-11-01'
}
dataset: [
{
dataset: 'mock-dataset',
start_date: '2020-11-01'
}
]
}

vi.setSystemTime(new Date('2022-02-01T00:00:00Z'))
Expand All @@ -104,10 +106,12 @@ describe('Dataset Overview Middleware', () => {
it('should set notice for overdue dataset', () => {
const reqWithDataset = {
...req,
dataset: {
dataset: 'mock-dataset',
startDate: '2020-01-01'
}
dataset: [
{
dataset: 'mock-dataset',
start_date: '2020-01-01'
}
]
}

vi.setSystemTime(new Date('2021-11-01T00:00:00Z'))
Expand All @@ -125,10 +129,12 @@ describe('Dataset Overview Middleware', () => {
lpa: 'mock-lpa',
dataset: 'unknown-dataset'
},
dataset: {
dataset: 'unknown-dataset',
startDate: '2022-01-01'
}
dataset: [
{
dataset: 'unknown-dataset',
start_date: '2022-01-01'
}
]
}

setNoticesFromSourceKey('dataset')(reqWithDataset, res, () => {})
Expand All @@ -138,10 +144,12 @@ describe('Dataset Overview Middleware', () => {
it('should set notice for due dataset at notice period boundary', () => {
const reqWithDataset = {
...req,
dataset: {
dataset: 'mock-dataset',
startDate: '2020-11-01'
}
dataset: [
{
dataset: 'mock-dataset',
start_date: '2020-11-01'
}
]
}

vi.setSystemTime(new Date('2022-02-01T15:30:00Z'))
Expand All @@ -157,10 +165,12 @@ describe('Dataset Overview Middleware', () => {
it('should set notice for due dataset with notice period 1', () => {
const reqWithDataset = {
...req,
dataset: {
dataset: 'mock-dataset-2',
startDate: '2020-11-01'
}
dataset: [
{
dataset: 'mock-dataset-2',
start_date: '2020-11-01'
}
]
}

utils.requiredDatasets = [
Expand All @@ -184,10 +194,12 @@ describe('Dataset Overview Middleware', () => {
it('should not set notice for due dataset with notice period 0', () => {
const reqWithDataset = {
...req,
dataset: {
dataset: 'mock-dataset-3',
startDate: '2020-11-01'
}
dataset: [
{
dataset: 'mock-dataset-3',
start_date: '2020-11-01'
}
]
}

utils.requiredDatasets = [
Expand Down
6 changes: 3 additions & 3 deletions test/unit/middleware/overview.middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('overview.middleware', () => {
'brownfield-land': [
{
dataset: 'brownfield-land',
startDate: '1995-03-17T10:00:00.000z'
start_date: '1995-03-17T10:00:00.000z'
}
]
}
Expand All @@ -173,7 +173,7 @@ describe('overview.middleware', () => {
'brownfield-land': [
{
dataset: 'brownfield-land',
startDate: '1994-03-17T10:00:00.000z'
start_date: '1994-03-17T10:00:00.000z'
}
]
}
Expand All @@ -190,7 +190,7 @@ describe('overview.middleware', () => {
'brownfield-land': [
{
dataset: 'brownfield-land',
startDate: '1996-03-17T10:00:00.000z'
start_date: '1996-03-17T10:00:00.000z'
}
]
}
Expand Down

0 comments on commit 7a153eb

Please sign in to comment.