Skip to content

Commit dbad75a

Browse files
committed
style: use lambda function to reset sandbox
1 parent c5f67af commit dbad75a

7 files changed

+9
-29
lines changed

packages/boot/test/acceptance/controller.booter.acceptance.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('controller booter acceptance tests', () => {
1313
const SANDBOX_PATH = resolve(__dirname, '../../.sandbox');
1414
const sandbox = new TestSandbox(SANDBOX_PATH);
1515

16-
beforeEach(resetSandbox);
16+
beforeEach('reset sandbox', () => sandbox.reset());
1717
beforeEach(getApp);
1818

1919
afterEach(stopApp);
@@ -55,8 +55,4 @@ describe('controller booter acceptance tests', () => {
5555
console.log(`Stopping the app threw an error: ${err}`);
5656
}
5757
}
58-
59-
async function resetSandbox() {
60-
await sandbox.reset();
61-
}
6258
});

packages/boot/test/integration/controller.booter.integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('controller booter integration tests', () => {
1717

1818
let app: BooterApp;
1919

20-
beforeEach(async () => await sandbox.reset());
20+
beforeEach('reset sandbox', () => sandbox.reset());
2121
beforeEach(getApp);
2222

2323
it('boots controllers when app.boot() is called', async () => {

packages/boot/test/integration/repository.booter.integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('repository booter integration tests', () => {
1717

1818
let app: BooterApp;
1919

20-
beforeEach(() => sandbox.reset());
20+
beforeEach('reset sandbox', () => sandbox.reset());
2121
beforeEach(getApp);
2222

2323
it('boots repositories when app.boot() is called', async () => {

packages/boot/test/unit/booters/booter-utils.unit.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('booter-utils unit tests', () => {
1111
const SANDBOX_PATH = resolve(__dirname, '../../../.sandbox');
1212
const sandbox = new TestSandbox(SANDBOX_PATH);
1313

14-
beforeEach(resetSandbox);
14+
beforeEach('reset sandbox', () => sandbox.reset());
1515

1616
describe('discoverFiles()', () => {
1717
beforeEach(setupSandbox);
@@ -102,8 +102,4 @@ describe('booter-utils unit tests', () => {
102102
expect(() => loadClassesFromFiles(files)).to.throw(/Cannot find module/);
103103
});
104104
});
105-
106-
async function resetSandbox() {
107-
await sandbox.reset();
108-
}
109105
});

packages/boot/test/unit/booters/controller.booter.unit.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('controller booter unit tests', () => {
1717

1818
let app: Application;
1919

20-
beforeEach(resetSandbox);
20+
beforeEach('reset sandbox', () => sandbox.reset());
2121
beforeEach(getApp);
2222

2323
it(`constructor uses ControllerDefaults for 'options' if none are given`, () => {
@@ -62,8 +62,4 @@ describe('controller booter unit tests', () => {
6262
function getApp() {
6363
app = new Application();
6464
}
65-
66-
async function resetSandbox() {
67-
await sandbox.reset();
68-
}
6965
});

packages/boot/test/unit/booters/repository.booter.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('repository booter unit tests', () => {
2121
let app: RepoApp;
2222
let stub: sinon.SinonStub;
2323

24-
beforeEach(() => sandbox.reset());
24+
beforeEach('reset sandbox', () => sandbox.reset());
2525
beforeEach(getApp);
2626
beforeEach(createStub);
2727
afterEach(restoreStub);

packages/cli/test/clone-example.test.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const readFile = promisify(fs.readFile);
1818

1919
const VALID_EXAMPLE = 'getting-started';
2020
const SANDBOX_PATH = path.resolve(__dirname, '..', '.sandbox');
21-
let sandbox;
21+
const sandbox = new TestSandbox(SANDBOX_PATH);
2222

2323
describe('cloneExampleFromGitHub (SLOW)', function() {
2424
this.timeout(20000);
25-
before(createSandbox);
26-
beforeEach(resetSandbox);
25+
26+
beforeEach('reset sandbox', () => sandbox.reset());
2727

2828
it('extracts project files', async () => {
2929
const outDir = await cloneExampleFromGitHub(VALID_EXAMPLE, SANDBOX_PATH);
@@ -55,12 +55,4 @@ describe('cloneExampleFromGitHub (SLOW)', function() {
5555
name: `@loopback/example-${VALID_EXAMPLE}`,
5656
});
5757
});
58-
59-
function createSandbox() {
60-
sandbox = new TestSandbox(SANDBOX_PATH);
61-
}
62-
63-
function resetSandbox() {
64-
sandbox.reset();
65-
}
6658
});

0 commit comments

Comments
 (0)