mattermost-mobile/app/components/post_list/date_header/utils.test.js
Jesse Hallam 36dd3f19e2 MM-11198: avoid duplicate date line keys (#1901)
* MM-11198: avoid duplicate keys in date lines

Ensure each dateline rendered as part of search, recent mentions, or flagged post list has a unique key, even if the same date itself appears multiple times.

* update post_list.test.js to actually test date boundaries, relying on TZ=utc export in package.json

* unit test makePreparePostIdsForSearchPosts

* fix eslint issues

* try TZ=GMT

* encode date lines using timestamps instead

This requires a few extra changes to the post list proper, but largely
simplifies things anyway.
2018-07-09 18:35:43 -04:00

17 lines
572 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import assert from 'assert';
import {isDateLine} from './utils.js';
describe('DateHeader', () => {
it('isDateLine', () => {
assert.equal(isDateLine(''), false);
assert.equal(isDateLine('date'), false);
assert.equal(isDateLine('date-'), true);
assert.equal(isDateLine('date-0'), true);
assert.equal(isDateLine('date-1531152392'), true);
assert.equal(isDateLine('date-1531152392-index'), true);
});
});