Skip to content

Commit

Permalink
repository.test.js stricter regexp matching
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed May 8, 2020
1 parent 36356ab commit 5b4aa22
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/server/saved_objects/service/lib/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,17 +825,15 @@ describe('SavedObjectsRepository', () => {
// Assert that both raw docs from the ES response are deserialized
expect(serializer.rawToSavedObject).toHaveBeenNthCalledWith(1, {
...response.items[0].create,
_id: expect.stringMatching(/myspace:config:[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/),
_id: expect.stringMatching(/^myspace:config:[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/),
});
expect(serializer.rawToSavedObject).toHaveBeenNthCalledWith(2, response.items[1].create);

// Assert that ID's are deserialized to remove the type and namespace
expect(result.saved_objects[0].id).toEqual(
expect.not.stringMatching(/config|index-pattern|myspace/)
);
expect(result.saved_objects[1].id).toEqual(
expect.not.stringMatching(/config|index-pattern|myspace/)
expect.stringMatching(/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/)
);
expect(result.saved_objects[1].id).toEqual(obj2.id);
});
});
});
Expand Down

0 comments on commit 5b4aa22

Please sign in to comment.