Skip to content

Commit

Permalink
Check I got google timezone parsing with fallback right
Browse files Browse the repository at this point in the history
  • Loading branch information
Lan2u committed Sep 25, 2024
1 parent 858936d commit 5b9f22d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as O from 'fp-ts/Option';
import {columnBoundsRequired} from '../src/training-sheets/google';
import {columnBoundsRequired} from '../../src/training-sheets/google';

describe('columnBoundsRequired', () => {
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getChunkIndexes} from '../src/util';
import {getChunkIndexes} from '../../src/util';

describe('Get chunk indexes', () => {
[
Expand Down
25 changes: 25 additions & 0 deletions tests/training-sheets/google-timezone.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {GoogleTimezone} from '../../src/init-dependencies/google/pull_sheet_data';
import {getRightOrFail} from '../helpers';

describe('Google timezone parse', () => {
it('Empty default', () => {
expect(getRightOrFail(GoogleTimezone.decode(''))).toStrictEqual(
'Europe/London'
);
});
it('Malformed default', () => {
expect(getRightOrFail(GoogleTimezone.decode(null))).toStrictEqual(
'Europe/London'
);
});
it('Known timezone', () => {
expect(getRightOrFail(GoogleTimezone.decode('Africa/Cairo'))).toStrictEqual(
'Africa/Cairo'
);
});
it('Unknown timezone', () => {
expect(
getRightOrFail(GoogleTimezone.decode('Makespace/Cambridge'))
).toStrictEqual('Europe/London');
});
});

0 comments on commit 5b9f22d

Please sign in to comment.