Skip to content

Commit

Permalink
Add unit test for the naming of our destination migration index
Browse files Browse the repository at this point in the history
  • Loading branch information
rylnd committed Dec 7, 2020
1 parent 70031ad commit d0c2634
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { ElasticsearchClient } from 'src/core/server';
import { elasticsearchServiceMock } from 'src/core/server/mocks';
import { createSignalsMigrationIndex } from './create_signals_migration_index';

describe('getMigrationStatus', () => {
let esClient: ElasticsearchClient;

beforeEach(() => {
esClient = elasticsearchServiceMock.createElasticsearchClient();
});

it('creates an index suffixed with the template version', async () => {
await createSignalsMigrationIndex({ esClient, index: 'my-signals-index', version: 4 });

expect(esClient.indices.create).toHaveBeenCalledWith(
expect.objectContaining({ index: 'my-signals-index-r000004' })
);
});
});

0 comments on commit d0c2634

Please sign in to comment.