-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add updated_at columnb to objects' tables Signed-off-by: sitbubu <royi.sitbon@logz.io> * Grammer and iso usage Signed-off-by: sitbubu <royi.sitbon@logz.io> * Set updated at field from advanced settings Signed-off-by: sitbubu <royi.sitbon@logz.io> * Use dateFormat instead of dateFormat:scaled Signed-off-by: sitbubu <royi.sitbon@logz.io> * snapshot Signed-off-by: sitbubu <royi.sitbon@logz.io> * Add updated_at to additional comment Signed-off-by: sitbubu <royi.sitbon@logz.io> * Add unit-tests for updated_at as null undefined or unknown Signed-off-by: sitbubu <royi.sitbon@logz.io> * Simplify test file Signed-off-by: sitbubu <royi.sitbon@logz.io> * Simplified header and import from src Signed-off-by: sitbubu <royi.sitbon@logz.io> Signed-off-by: sitbubu <royi.sitbon@logz.io> (cherry picked from commit 8874afd) Co-authored-by: Royi Sitbon <royi.sitbon@logz.io>
- Loading branch information
1 parent
3aacdc3
commit 9f8dd0c
Showing
13 changed files
with
305 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 132 additions & 6 deletions
138
...plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/plugins/saved_objects/public/saved_object/saved_object_loader.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { SavedObjectsClientContract } from 'opensearch-dashboards/public'; | ||
import { SavedObjectLoader } from './saved_object_loader'; | ||
|
||
describe('SimpleSavedObjectLoader', () => { | ||
const createLoader = (updatedAt?: any) => { | ||
const id = 'logstash-*'; | ||
const type = 'index-pattern'; | ||
|
||
const savedObject = { | ||
attributes: {}, | ||
id, | ||
type, | ||
updated_at: updatedAt as any, | ||
}; | ||
|
||
client = { | ||
...client, | ||
find: jest.fn(() => | ||
Promise.resolve({ | ||
total: 1, | ||
savedObjects: [savedObject], | ||
}) | ||
), | ||
} as any; | ||
|
||
return new SavedObjectLoader(savedObject, client); | ||
}; | ||
|
||
let client: SavedObjectsClientContract; | ||
let loader: SavedObjectLoader; | ||
beforeEach(() => { | ||
client = { | ||
update: jest.fn(), | ||
create: jest.fn(), | ||
delete: jest.fn(), | ||
} as any; | ||
}); | ||
|
||
afterEach(async () => { | ||
const savedObjects = await loader.findAll(); | ||
|
||
expect(savedObjects.hits[0].updated_at).toEqual(undefined); | ||
}); | ||
|
||
it('set updated_at as undefined if undefined', async () => { | ||
loader = createLoader(undefined); | ||
}); | ||
|
||
it("set updated_at as undefined if doesn't exist", async () => { | ||
loader = createLoader(); | ||
}); | ||
|
||
it('set updated_at as undefined if null', async () => { | ||
loader = createLoader(null); | ||
}); | ||
}); |
Oops, something went wrong.