2021-11-17 17:30:59 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
import { setupMirage } from 'ember-cli-mirage/test-support';
|
|
|
|
import { render, triggerEvent, click } from '@ember/test-helpers';
|
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Integration | Component | raft-storage-restore', function (hooks) {
|
2021-11-17 17:30:59 +00:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
setupMirage(hooks);
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it should restore snapshot', async function (assert) {
|
2021-11-17 17:30:59 +00:00
|
|
|
assert.expect(2);
|
|
|
|
|
|
|
|
this.server.post('/sys/storage/raft/snapshot', () => {
|
|
|
|
assert.ok(true, 'Request made to restore snapshot');
|
|
|
|
return;
|
|
|
|
});
|
|
|
|
this.server.post('/sys/storage/raft/snapshot-force', () => {
|
|
|
|
assert.ok(true, 'Request made to force restore snapshot');
|
|
|
|
return;
|
|
|
|
});
|
|
|
|
|
|
|
|
await render(hbs`<RaftStorageRestore />`);
|
|
|
|
await triggerEvent('[data-test-file-input]', 'change', {
|
|
|
|
files: [new Blob(['Raft Snapshot'])],
|
|
|
|
});
|
|
|
|
await click('[data-test-edit-form-submit]');
|
|
|
|
await click('#force-restore');
|
|
|
|
await click('[data-test-edit-form-submit]');
|
|
|
|
});
|
|
|
|
});
|