import {
  activate,
  config,
  write,
} from '../lib'
import test from 'ava'

test('has config', t => {
  t.ok(typeof config === 'object', 'Package does not export a config')
})

test('will activate', t => {
  t.ok(typeof activate === 'function', 'Package does not export a config')
})

test.todo('getStatusColors')

test('write works', t => {
  // Emulate a file
  class File {
    constructor() {
      this.content = ''
    }

    write = content => { this.content = content }
  }
  const inputFile = new File()
  const outputFile = new File()

  inputFile.write('@mixin ends js;')

  const expected = ''

  write(inputFile, outputFile)

  t.ok(outputFile.content === expected, 'write did not output correctly')
})

test('activate works', t => {
  class File {
    constructor( location ) {
      this.content = ''
      this.path = location
    }

    create = () => new Promise(resolve => resolve(true))

    readSync = () => this.content

    writeSync = content => { this.content = content }
  }

  const atom = {
    File,
    config: {
      defaultSettings: {
        flexicons: {
          global: {
            muted: false,
            status: true,
          },
          icons: {
            js: {
              disabled: false,
              icon: 'JavaScript',
              overlay: {
                enabled: false,
                color: 'transparent',
              },
            },
          },
        },
      },
      onDidChange: ( scope, callbackFn ) =>
        callbackFn({ newValue: atom.config.defaultSettings.flexicons }),
    },
    packages: {
      getLoadedPackage: () => ({
        reloadStylesheets: () => {},
      }),
      onDidActivateInitialPackages: callbackFn => callbackFn(),
    },
    styles: {
      styleElementsBySourcePath: {},
    },
  }

  // Mock `apm test`
  global.atom = atom

  activate(null, () => ({ File }))

  t.pass()
})

@@ -24,16 +24,35 @@
 config,%0A
+  getStatusColors,%0A
   write,
@@ -52,16 +52,16 @@
  write,%0A
-
 %7D from '
@@ -309,31 +309,430 @@
 test
-.todo('getStatusColors'
+('getStatusColors works', t =%3E %7B%0A  const atom = %7B%0A    styles: %7B%0A      styleElementsBySourcePath: %7B%0A        '~/atom/packages/flexicons/styles/variables.less': %7B%0A          innerHTML: %60%0A:root %7B%0A  --color: #ffffff;%0A%7D%60,%0A        %7D,%0A      %7D,%0A    %7D,%0A  %7D%0A%0A  // Mock %60apm test%60%0A  global.atom = atom%0A%0A  const actual = getStatusColors()%0A  const expected = %5B '#ffffff' %5D%0A%0A  t.same(actual, expected, 'proper colors were not returned')%0A%7D
 )%0A%0At

Add test for `getStatusColors`