kopia lustrzana https://github.com/wagtail/wagtail
Fix incorrect UpgradeController test
The current version is set to 2.3 at the top level of the test. If the test case uses 5.15.1 as the latest version, then the test should've failed – but it didn't because we're missing a few promises to be awaited. To verify, try reverting the version diff and re-run the test. It would fail with the new assertions.pull/12387/head
rodzic
0f0d871c5e
commit
88342e944b
|
@ -8,7 +8,7 @@ describe('UpgradeController', () => {
|
|||
const version = '2.3';
|
||||
|
||||
beforeEach(() => {
|
||||
document.body.innerHTML = `
|
||||
document.body.innerHTML = /* html */ `
|
||||
<div
|
||||
class="panel"
|
||||
id="panel"
|
||||
|
@ -78,7 +78,7 @@ describe('UpgradeController', () => {
|
|||
|
||||
it('should not show the message if the current version is up to date', async () => {
|
||||
const data = {
|
||||
version: '5.15.1',
|
||||
version: '2.3',
|
||||
url: 'https://docs.wagtail.org/latest/url',
|
||||
minorUrl: 'https://docs.wagtail.org/latest-minor/url',
|
||||
lts: {
|
||||
|
@ -99,6 +99,16 @@ describe('UpgradeController', () => {
|
|||
// trigger next browser render cycle
|
||||
await Promise.resolve();
|
||||
|
||||
expect(global.fetch).toHaveBeenCalledWith(
|
||||
'https://releases.wagtail.org/mock.txt',
|
||||
{ referrerPolicy: 'strict-origin-when-cross-origin' },
|
||||
);
|
||||
|
||||
expect(document.getElementById('panel').hidden).toBe(true);
|
||||
|
||||
await new Promise(requestAnimationFrame);
|
||||
|
||||
// should keep the hidden attribute
|
||||
expect(document.getElementById('panel').hidden).toBe(true);
|
||||
});
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue