Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fsuipc-node/api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.4.0
Choose a base ref
...
head repository: fsuipc-node/api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.4.1
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Feb 1, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9b21f19 View commit details
  2. Copy the full SHA
    da8a32e View commit details
Showing with 20 additions and 7 deletions.
  1. +9 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +6 −2 src/api.ts
  4. +4 −4 tests/api.spec.ts
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [0.4.1](https://github.com/fsuipc-node/api/compare/0.4.0...0.4.1) (2021-02-01)


### Bug Fixes

* allow connexion to MSFS ([#9](https://github.com/fsuipc-node/api/issues/9)) ([9b21f19](https://github.com/fsuipc-node/api/commit/9b21f197cb6a9ef8eceee7d85e3f6b3f0a5c20aa))



# [0.4.0](https://github.com/fsuipc-node/api/compare/0.3.0...0.4.0) (2020-02-04)


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fsuipc/api",
"version": "0.4.0",
"version": "0.4.1",
"author": {
"name": "FSUIPC-Node Opensource Team",
"url": "https://github.com/fsuipc-node"
8 changes: 6 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -13,13 +13,17 @@ export class FsuipcApi {
private fsuipc: FSUIPC;
private watchedOffsetCache: any[] = [];

constructor(private simulator: Simulator = Simulator.FSX) {}
constructor(private simulator?: Simulator) {}

public async init() {
this.fsuipcGlobalInstance = new FSUIPC();

try {
this.fsuipc = await this.fsuipcGlobalInstance.open(this.simulator);
if (this.simulator){
this.fsuipc = await this.fsuipcGlobalInstance.open(this.simulator);
} else {
this.fsuipc = await this.fsuipcGlobalInstance.open();
}
return true;
} catch (error) {
throw new FSUIPCError(error.message, error.code);
8 changes: 4 additions & 4 deletions tests/api.spec.ts
Original file line number Diff line number Diff line change
@@ -37,8 +37,8 @@ jest.mock('fsuipc', () => {
return {
FSUIPC: jest.fn().mockImplementation(() => {
return {
open: jest.fn().mockImplementation((simulator) => {
if (simulator === SimulatorMock.FSX) {
open: jest.fn().mockImplementation((simulator?) => {
if (simulator !== SimulatorMock.P3D64) {
return Promise.resolve({
process: processMock,
add: addMock,
@@ -163,9 +163,9 @@ describe('FSUIPC Api', () => {
expect(instance['simulator']).toEqual(SimulatorMock.P3D64);
});

it('should create instance with FSX by default when no simulator provided', () => {
it('should create instance with any Simulator by default when no simulator provided', () => {
const instance = new FsuipcApi();
expect(instance['simulator']).toEqual(SimulatorMock.FSX);
expect(instance['simulator']).toEqual(undefined);
});
});