test: ensure single top-level describe block in test file (#1094)

This makes it easier to map test output to files and allows for common
setup & teardown of all tests in a file.

* test(prepare): wrap in top-level describe block
* test(Api): wrap in top-level describe block
This commit is contained in:
Raphael von der Grün 2020-10-17 23:20:37 +02:00
parent 3b56160d38
commit b1f01d7a65
2 changed files with 704 additions and 700 deletions

View File

@ -29,7 +29,8 @@ var PluginInfo = common.PluginInfo;
var FIXTURES = path.join(__dirname, '../e2e/fixtures');
var FAKE_PROJECT_DIR = path.join(os.tmpdir(), 'plugin-test-project');
describe('addPlugin method', function () {
describe('Api', () => {
describe('addPlugin method', function () {
var api, Api;
beforeEach(function () {
@ -64,4 +65,5 @@ describe('addPlugin method', function () {
expect(api._builder.prepBuildFiles).not.toHaveBeenCalled();
});
});
});
});

View File

@ -81,7 +81,8 @@ function mockGetIconItem (data) {
}, data);
}
describe('updateIcons method', function () {
describe('prepare', () => {
describe('updateIcons method', function () {
// Rewire
let prepare;
@ -490,9 +491,9 @@ describe('updateIcons method', function () {
const expectedResourceMap = phaseTwoUpdatedIconsForLegacy;
expect(actualResourceMap).toEqual(expectedResourceMap);
});
});
});
describe('prepareIcons method', function () {
describe('prepareIcons method', function () {
let prepare;
let emitSpy;
let prepareIcons;
@ -554,9 +555,9 @@ describe('prepareIcons method', function () {
expect(expected).toEqual(actual);
});
});
});
describe('updateIconResourceForLegacy method', function () {
describe('updateIconResourceForLegacy method', function () {
let prepare;
// Spies
@ -602,9 +603,9 @@ describe('updateIconResourceForLegacy method', function () {
expect(actual).toEqual(expected);
});
});
});
describe('updateIconResourceForAdaptive method', function () {
describe('updateIconResourceForAdaptive method', function () {
let prepare;
// Spies
@ -653,9 +654,9 @@ describe('updateIconResourceForAdaptive method', function () {
expect(actual).toEqual(expected);
});
});
});
describe('cleanIcons method', function () {
describe('cleanIcons method', function () {
let prepare;
let emitSpy;
let updatePathsSpy;
@ -751,9 +752,9 @@ describe('cleanIcons method', function () {
const actualResourceMap = updatePathsSpy.calls.argsFor(0)[0];
expect(actualResourceMap).toEqual(expectedResourceMap);
});
});
});
describe('prepare arguments', () => {
describe('prepare arguments', () => {
// Rewire
let Api;
let api;
@ -831,4 +832,5 @@ describe('prepare arguments', () => {
})
).toBeResolved();
});
});
});