platform.test.ts 434 B

1234567891011121314151617
  1. import test from 'ava';
  2. import { getPlatform } from '../src/index.js';
  3. if (__BROWSER__) {
  4. test('it returns the browser platform', t => {
  5. t.is(getPlatform(), 'browser');
  6. });
  7. } else if (__REACTNATIVE__) {
  8. test('it returns the react native platform', t => {
  9. t.is(getPlatform(), 'react-native');
  10. });
  11. } else {
  12. test('it returns the node platform', t => {
  13. t.is(getPlatform(), 'node');
  14. });
  15. }