Skip to content

Commit 2bcc93c

Browse files
committed
Add test for getShortId
1 parent 4579f5e commit 2bcc93c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/domain.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,28 @@ describe('store: [adapter=DOMAIN]', () => {
212212
});
213213
});
214214

215+
describe('getShortId()', () => {
216+
it('should return short (8 chars) unique value if store is initialized.', done => {
217+
const callback = () => {
218+
expect(globalStore.getShortId()).to.be.an('string');
219+
expect(globalStore.getShortId()).to.not.equal(null);
220+
expect(globalStore.getShortId()).to.not.equal(undefined);
221+
expect(globalStore.getShortId()).to.be.lengthOf(8);
222+
223+
done();
224+
};
225+
226+
globalStore.initialize(adapter)(callback);
227+
});
228+
229+
it('should return `undefined` if store is not initialized.', done => {
230+
expect(globalStore.getShortId).to.not.throw();
231+
expect(globalStore.getShortId()).to.equal(undefined);
232+
233+
done();
234+
});
235+
});
236+
215237
describe('find()', () => {
216238
it('should successfully return value in synchronous callback.', done => {
217239
const callback = () => {

0 commit comments

Comments
 (0)