Skip to content

Commit

Permalink
Fix failing UI test for tied records
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaSheep committed Oct 27, 2023
1 parent b816166 commit a1d2ba1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ const mockRecordData: Record[] = [
{
eventName: "3x3x3 Cube",
eventId: "333",
singleName: "John Doe",
singleResult: "1:00:00",
singleId: "1",
singleDate: mockPastDate,
averageName: "John Doe",
singleName: ["John Doe"],
singleId: ["1"],
singleDate: [mockPastDate],
averageResult: "1:30:00",
averageId: "1",
averageDate: mockPastDate,
averageName: ["John Doe"],
averageId: ["1"],
averageDate: [mockPastDate],
eventRank: 1
},
{
eventName: "Skewb",
eventId: "skewb",
singleName: "Bob Person",
singleResult: "0:30:00",
singleId: "2",
singleDate: mockNewDate,
averageName: "Someone Else",
singleName: ["Bob Person"],
singleId: ["2"],
singleDate: [mockNewDate],
averageResult: "0:40:00",
averageId: "3",
averageDate: mockNewDate,
averageName: ["Someone Else"],
averageId: ["3"],
averageDate: [mockNewDate],
eventRank: 2
}
];
Expand Down Expand Up @@ -103,12 +103,28 @@ describe('NationalRecordsListComponent', () => {
describe('isNew', () => {

it('should return true for dates within the last month', () => {
expect(component.isNew(mockToday)).toBeTrue();
expect(component.isNew(mockNewDate)).toBeTrue();
expect(component.isNew([mockToday])).toBeTrue();
expect(component.isNew([mockNewDate])).toBeTrue();
});

it('should return false for dates older than a month', () => {
expect(component.isNew(mockPastDate)).toBeFalse();
expect(component.isNew([mockPastDate])).toBeFalse();
});

it('should return false for empty dates', () => {
expect(component.isNew([])).toBeFalse();
});

it('should return false for multiple past dates', () => {
expect(component.isNew([mockPastDate, mockPastDate])).toBeFalse();
});

it('should return true for multiple new dates', () => {
expect(component.isNew([mockToday, mockNewDate])).toBeTrue();
});

it('should return true for a mix of new and old dates', () => {
expect(component.isNew([mockToday, mockPastDate])).toBeTrue();
});

it('should show a NEW tag for new records', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,47 @@ const mockProvincialRecords: ProvincialRecordTable = {
{
eventName: "3x3x3 Cube",
eventId: "333",
singleName: "Test Person",
singleResult: "1:00:00",
singleId: "2345TEST01",
averageName: "Test Person",
singleName: ["Test Person"],
singleId: ["2345TEST01"],
averageResult: "1:30:00",
averageId: "2345TEST02",
averageName: ["Test Person"],
averageId: ["2345TEST02"],
province: "GT"
},
{
eventName: "3x3x3 Cube",
eventId: "333",
singleName: "Test Person",
singleResult: "1:00:00",
singleId: "2345TEST03",
averageName: "Another Person",
singleName: ["Test Person"],
singleId: ["2345TEST03"],
averageResult: "1:30:00",
averageId: "2345TEST04",
averageName: ["Another Person"],
averageId: ["2345TEST04"],
province: "WC"
}
],
"222": [
{
eventName: "2x2x2 Cube",
eventId: "222",
singleName: "Someone Else",
singleResult: "1:00:00",
singleId: "2345TEST01",
averageName: "",
singleName: ["Someone Else"],
singleId: ["2345TEST01"],
averageResult: "",
averageId: "",
averageName: [],
averageId: [],
province: "GT"
},
{
eventName: "2x2x2 Cube",
eventId: "222",
singleName: "Test Person",
singleResult: "1:00:00",
singleId: "2345TEST03",
averageName: "",
singleName: ["Test Person"],
singleId: ["2345TEST03"],
averageResult: "",
averageId: "",
averageName: [],
averageId: [],
province: "WC"
}
]
Expand Down

0 comments on commit a1d2ba1

Please sign in to comment.