All files travis.js

70% Statements 7/10
100% Branches 2/2
62.5% Functions 5/8
70% Lines 7/10
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              9x         2x       5x 5x 5x     1x 1x        
// @flow
"use strict"
 
import type { Env } from "./ci_source"
import { ensureEnvKeysExist, ensureEnvKeysAreInt } from "./ci_source_helpers"
export default class Travis {
  env: Env
  constructor(env: Env) { this.env = env }
 
  get name(): string { return "Travis CI" }
 
  get isCI() : boolean {
    return ensureEnvKeysExist(this.env, ["HAS_JOSH_K_SEAL_OF_APPROVAL"])
  }
 
  get isPR() : boolean {
    let mustHave = ["HAS_JOSH_K_SEAL_OF_APPROVAL", "TRAVIS_PULL_REQUEST"]
    let mustBeInts = ["TRAVIS_REPO_SLUG"]
    return ensureEnvKeysExist(this.env, mustHave) && ensureEnvKeysAreInt(this.env, mustBeInts)
  }
 
  get pullRequestID(): string { return this.env.TRAVIS_PULL_REQUEST }
  get repoSlug(): string { return this.env.TRAVIS_REPO_SLUG }
  get repoURL(): string { return "maybe not needed?" }
  get supportedPlatforms() : string[] { return ["github"] }
}