Skip to content

Commit 3feeb84

Browse files
committed
Fixing test for cache validity
1 parent 056ec57 commit 3feeb84

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/appTemplates/Application.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ class Application {
133133
* Get current settings previously set with setCustomSettings()
134134
*/
135135
async getCustomSettings (forceRefresh = false) {
136-
if (forceRefresh || this.cache.customSettingsEvent) {
136+
if (forceRefresh || !this.cache.customSettingsEvent) {
137+
console.log('>>A');
137138
const customSettingsEvent = (await this.connection.apiOne('events.get', { streams: [this.baseStreamId], types: ['settings/any'], limit: 1 }, 'events'))[0];
138139
this.cache.customSettingsEvent = customSettingsEvent;
139140
}

tests/applicationClass.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ describe('[APAX] Application class', () => {
2929
assert.deepEqual(newSettings, newSettings1);
3030
const newSettings2 = await appDummy.getCustomSettings();
3131
assert.deepEqual(newSettings, newSettings2);
32-
// assert.equal(newSettings1, newSettings2, 'should be the same object');
32+
assert.deepEqual(newSettings1, newSettings2);
33+
assert.equal(newSettings1, newSettings2, 'should be the same object');
3334
const newSettings3 = await appDummy.getCustomSettings(true);
3435
assert.deepEqual(newSettings1, newSettings3);
36+
assert.notEqual(newSettings1, newSettings3, 'should not be the same object');
3537
});
3638
});
3739

0 commit comments

Comments
 (0)