Skip to content

Commit

Permalink
Add back in modTime & createTime fields
Browse files Browse the repository at this point in the history
  • Loading branch information
louise-davies committed Aug 30, 2024
1 parent 3e85a7b commit 4aa7152
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 20 deletions.
6 changes: 4 additions & 2 deletions packages/datagateway-common/src/app.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ export interface Dataset {
export interface Datafile {
id: number;
name: string;
datafileModTime: string;
datafileCreateTime: string;
modTime: string;
createTime: string;
datafileModTime?: string;
datafileCreateTime?: string;
fileSize?: number;
location?: string;
description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ describe('DetailsPane', () => {
expect(
await screen.findByText('datafiles.details.mod_time')
).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileModTime)).toBeInTheDocument();
expect(
screen.getByText(mockDatafile.datafileModTime)
).toBeInTheDocument();
});

it('with an unknown message if the last modified time is unknown', async () => {
renderComponent({
datafile: {
...mockDatafile,
datafileModTime: '',
datafileModTime: undefined,
},
});

Expand All @@ -121,14 +123,16 @@ describe('DetailsPane', () => {
expect(
await screen.findByText('datafiles.details.create_time')
).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileCreateTime)).toBeInTheDocument();
expect(
screen.getByText(mockDatafile.datafileCreateTime)
).toBeInTheDocument();
});

it('with an unknown message if the creation date is unknown', async () => {
renderComponent({
datafile: {
...mockDatafile,
datafileCreateTime: '',
datafileCreateTime: undefined,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import type { Datafile } from 'datagateway-common';

const mockDatafile = {
datafileCreateTime: '2020-01-01',
createTime: '2020-01-01',
datafileCreateTime: '2019-01-01',
dataset: undefined,
description: 'test description',
fileSize: 100,
id: 123,
location: 'test location',
datafileModTime: '2020-01-02',
modTime: '2020-01-02',
datafileModTime: '2019-01-02',
name: 'Datafile.txt',
parameters: [],
} satisfies Datafile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ describe('Datafile table component', () => {
name: 'Test 1',
location: '/test1',
fileSize: 1,
datafileModTime: '2019-07-23',
datafileCreateTime: '2019-07-23',
modTime: '2019-07-23',
createTime: '2019-07-23',
datafileModTime: '2019-01-02',
datafileCreateTime: '2019-01-01',
},
];
history = createMemoryHistory();
Expand Down Expand Up @@ -200,7 +202,7 @@ describe('Datafile table component', () => {
findCellInRow(row, {
columnIndex: await findColumnIndexByName('datafiles.modified_time'),
})
).getByText('2019-07-23')
).getByText('2019-01-02')
).toBeInTheDocument();
});

Expand Down Expand Up @@ -243,7 +245,9 @@ describe('Datafile table component', () => {

expect(history.length).toBe(2);
expect(history.location.search).toBe(
`?filters=${encodeURIComponent('{"datafileModTime":{"endDate":"2019-08-06"}}')}`
`?filters=${encodeURIComponent(
'{"datafileModTime":{"endDate":"2019-08-06"}}'
)}`
);

// await user.clear(filterInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ describe('DLS datafiles table component', () => {
name: 'Test 1',
location: '/test1',
fileSize: 1,
datafileModTime: '2019-07-23',
datafileCreateTime: '2019-07-23',
modTime: '2019-07-23',
createTime: '2019-07-23',
datafileModTime: '2019-01-02',
datafileCreateTime: '2019-01-01',
},
];
history = createMemoryHistory();
Expand Down Expand Up @@ -165,7 +167,7 @@ describe('DLS datafiles table component', () => {
findCellInRow(row, {
columnIndex: await findColumnIndexByName('datafiles.create_time'),
})
).getByText('2019-07-23')
).getByText('2019-01-01')
).toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ describe('ISIS datafiles table component', () => {
name: 'Test 1',
location: '/test1',
fileSize: 1,
datafileModTime: '2019-07-23',
datafileCreateTime: '2019-07-23',
modTime: '2019-07-23',
createTime: '2019-07-23',
datafileModTime: '2019-01-02',
datafileCreateTime: '2019-01-01',
},
];
cartItems = [];
Expand Down Expand Up @@ -201,7 +203,7 @@ describe('ISIS datafiles table component', () => {
findCellInRow(row, {
columnIndex: await findColumnIndexByName('datafiles.modified_time'),
})
).getByText('2019-07-23')
).getByText('2019-01-02')
).toBeInTheDocument();
});

Expand Down
4 changes: 2 additions & 2 deletions packages/datagateway-download/src/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ export const mockDatafiles: Datafile[] = [
{
id: 70,
name: 'datafile weekend',
datafileModTime: '2018-03-10T08:19:55Z',
datafileCreateTime: '2018-03-10T08:19:55Z',
modTime: '2018-03-10T08:19:55Z',
createTime: '2018-03-10T08:19:55Z',
dataset: mockDatasets[0],
},
];
Expand Down

0 comments on commit 4aa7152

Please sign in to comment.