Commit a7e0f810 authored by Clement Ho's avatar Clement Ho

Add spec for getKeys()

parent f9d32b3a
...@@ -18,6 +18,17 @@ describe('Filtered Search Token Keys', () => { ...@@ -18,6 +18,17 @@ describe('Filtered Search Token Keys', () => {
}); });
}); });
describe('getKeys', () => {
it('should return keys', () => {
const getKeys = gl.FilteredSearchTokenKeys.getKeys();
const keys = gl.FilteredSearchTokenKeys.get().map(i => i.key);
keys.forEach((key, i) => {
expect(key).toEqual(getKeys[i]);
});
});
});
describe('getConditions', () => { describe('getConditions', () => {
let conditions; let conditions;
......
...@@ -30,6 +30,23 @@ require('~/filtered_search/filtered_search_token_keys_with_weights'); ...@@ -30,6 +30,23 @@ require('~/filtered_search/filtered_search_token_keys_with_weights');
const match = tokenKeys.find(tk => tk.key === weightTokenKey.key); const match = tokenKeys.find(tk => tk.key === weightTokenKey.key);
expect(match).toEqual(weightTokenKey); expect(match).toEqual(weightTokenKey);
}); });
it('should always return the same array', () => {
const tokenKeys2 = gl.FilteredSearchTokenKeysWithWeights.get();
expect(tokenKeys).toEqual(tokenKeys2);
});
});
describe('getKeys', () => {
it('should return keys', () => {
const getKeys = gl.FilteredSearchTokenKeysWithWeights.getKeys();
const keys = gl.FilteredSearchTokenKeysWithWeights.get().map(i => i.key);
keys.forEach((key, i) => {
expect(key).toEqual(getKeys[i]);
});
});
}); });
describe('getConditions', () => { describe('getConditions', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment