Skip to content

Commit

Permalink
feat(tillhub): adds environment information
Browse files Browse the repository at this point in the history
  • Loading branch information
eljefedelrodeodeljefe committed Jan 2, 2019
1 parent 9dc7b9b commit 6913937
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/environment.ts
@@ -0,0 +1,5 @@
declare function require(moduleName: string): any

export const environment = {
VERSION: require('../package.json').version
}
2 changes: 2 additions & 0 deletions src/tillhub-js.ts
Expand Up @@ -7,6 +7,7 @@ import * as v0 from './v0'
import * as v1 from './v1'
import { Client, ClientOptions } from './client'
import * as errors from './errors'
import { environment } from './environment'

export { v0, v1 }

Expand All @@ -26,6 +27,7 @@ export class TillhubClient {
http?: Client

public options: TillhubSDKOptions | undefined
public static environment = environment

constructor(options?: TillhubSDKOptions) {
// super()
Expand Down
9 changes: 9 additions & 0 deletions test/environment.test.ts
@@ -0,0 +1,9 @@
import { environment } from '../src/environment'

describe('SDK: environemt', () => {
it('Will have set environment version at compile time', () => {
expect(environment).toBeDefined()
expect(environment.VERSION).toBeDefined()
expect(environment.VERSION).toBe(process.env.npm_package_version)
})
})

0 comments on commit 6913937

Please sign in to comment.