-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
application-metadata.booter.acceptance.ts
38 lines (32 loc) · 1.29 KB
/
application-metadata.booter.acceptance.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright IBM Corp. 2019. All Rights Reserved.
// Node module: @loopback/boot
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {CoreBindings} from '@loopback/core';
import {expect, givenHttpServerConfig, TestSandbox} from '@loopback/testlab';
import {resolve} from 'path';
import {BooterApp} from '../fixtures/application';
describe('application metadata booter acceptance tests', () => {
let app: BooterApp;
const SANDBOX_PATH = resolve(__dirname, '../../.sandbox');
const sandbox = new TestSandbox(SANDBOX_PATH);
beforeEach('reset sandbox', () => sandbox.reset());
beforeEach(getApp);
it('binds content of package.json to application metadata', async () => {
await app.boot();
const metadata = await app.get(CoreBindings.APPLICATION_METADATA);
expect(metadata).containEql({
name: 'boot-test-app',
version: '1.0.0',
description: 'boot-test-app',
});
});
async function getApp() {
await sandbox.copyFile(resolve(__dirname, '../fixtures/package.json'));
await sandbox.copyFile(resolve(__dirname, '../fixtures/application.js'));
const MyApp = require(resolve(SANDBOX_PATH, 'application.js')).BooterApp;
app = new MyApp({
rest: givenHttpServerConfig(),
});
}
});