Skip to content

Commit 8172fea

Browse files
committed
manual: reload liblist if response is incorrect
1 parent 0a0c36b commit 8172fea

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

test/integration/manual/manual.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,27 @@ class Manual {
3737
this.#server.get('/getLibList', (req, res) => {
3838
let libList = { localhost: 'http://127.0.0.1:' + this.#port + '/example/lib' };
3939
libList['HEAD'] = 'https://' + remoteStableBucket + '/lib';
40+
this.#getLibJson().then(vizzuList => {
41+
vizzuList.slice().reverse().forEach(vizzu => {
42+
libList[vizzu.time.substring(0,10) + ' ' + vizzu.time.substring(11,16) + ' ' + vizzu.sha] = 'https://' + remoteLatestBucket + '/' + vizzu.sha;
43+
});
44+
//libList['0.3.1'] = 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
45+
//libList['0.3.0'] = 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
46+
libList['0.2.0'] = 'https://vizzuhq.github.io/vizzu-beta-release/0.2.0';
47+
res.send(libList);
48+
});
49+
});
50+
}
51+
52+
#getLibJson() {
53+
return new Promise(resolve => {
4054
fetch('https://' + remoteCloudFunctions + '/getVizzuList').then(vizzuListUrl => {
4155
vizzuListUrl.json().then(vizzuList => {
42-
vizzuList.slice().reverse().forEach(vizzu => {
43-
libList[vizzu.time.substring(0,10) + ' ' + vizzu.time.substring(11,16) + ' ' + vizzu.sha] = 'https://' + remoteLatestBucket + '/' + vizzu.sha;
44-
});
45-
//libList['0.3.1'] = 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
46-
//libList['0.3.0'] = 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
47-
libList['0.2.0'] = 'https://vizzuhq.github.io/vizzu-beta-release/0.2.0';
48-
res.send(libList);
49-
}).catch((err) => {
50-
console.log(err)
56+
resolve(vizzuList);
57+
}).catch((err) => {
58+
resolve(this.#getLibJson())
5159
});
52-
});
60+
});
5361
});
5462
}
5563

0 commit comments

Comments
 (0)