Removing tests which hadn't been updated since React (shame on me).
This commit is contained in:
1 parent
57010f89f4
commit
03c0476f46
12 files changed
-937
No files matched your search
@@ -1,33 +0,0 @@
|
||||
import { assert } from 'console';
|
||||
import { findStartTime } from './gpx';
|
||||
|
||||
describe('findStartTime', () => {
|
||||
test('to be undefined for a string', () => {
|
||||
const start = findStartTime('');
|
||||
expect(start).toBeUndefined();
|
||||
});
|
||||
test('to be undefined for an object without time key', () => {
|
||||
const start = findStartTime({ foo: 'foo', bar: 'bar' });
|
||||
expect(start).toBeUndefined();
|
||||
});
|
||||
test('to be the time value for an object with a time key', () => {
|
||||
const start = findStartTime({ foo: 'foo', time: 'bar' });
|
||||
expect(start).toEqual('bar');
|
||||
});
|
||||
test('to be the lowest time value for an object with several time keys', () => {
|
||||
const start = findStartTime({
|
||||
foo: { time: 'foo' },
|
||||
time: 'bar',
|
||||
bar: { time: 'a' },
|
||||
});
|
||||
expect(start).toEqual('a');
|
||||
});
|
||||
test('to be the lowest time value for an array with several objects with time keys', () => {
|
||||
const start = findStartTime({
|
||||
foos: [{ time: 'foo' }, { time: '0' }],
|
||||
time: 'bar',
|
||||
bar: { time: 'a' },
|
||||
});
|
||||
expect(start).toEqual('0');
|
||||
});
|
||||
});
|
||||
@@ -1,120 +0,0 @@
|
||||
import { route } from './docuri';
|
||||
import uri from './ids';
|
||||
|
||||
describe('Checking some DocURI features', () => {
|
||||
test(', basic route', () => {
|
||||
const gpx = route('gpx/:id');
|
||||
expect(gpx({ id: 10 })).toBe('gpx/10');
|
||||
});
|
||||
test(', basic route (vice-versa', () => {
|
||||
const gpx = route('gpx/:id');
|
||||
expect(gpx('gpx/10')).toMatchObject({ id: '10' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checking a multilevel route', () => {
|
||||
test(', using the two levels', () => {
|
||||
const gpx = route('gpx/:gpx/3trk/:trk');
|
||||
expect(gpx({ gpx: 10, trk: 0 })).toBe('gpx/10/3trk/0');
|
||||
});
|
||||
test(', using the two levels (vive-versa)', () => {
|
||||
const gpx = route('gpx/:gpx/3trk/:trk');
|
||||
expect(gpx('gpx/10/3trk/0')).toMatchObject({ gpx: '10', trk: '0' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checking a multilevel route with optional part', () => {
|
||||
test(', using the two levels', () => {
|
||||
const gpx = route('gpx/:gpx(/3trk/:trk)');
|
||||
expect(gpx({ gpx: 10, trk: 0 })).toBe('gpx/10/3trk/0');
|
||||
});
|
||||
test(', using the two levels (vive-versa)', () => {
|
||||
const gpx = route('gpx/:gpx(/3trk/:trk)');
|
||||
expect(gpx('gpx/10/3trk/0')).toMatchObject({ gpx: '10', trk: '0' });
|
||||
});
|
||||
test(', using only one level', () => {
|
||||
const gpx = route('gpx/:gpx(/3trk/:trk)');
|
||||
expect(gpx({ gpx: 10 })).toBe('gpx/10/3trk/'); //Unfortunately !
|
||||
});
|
||||
test(', using only one level (vive-versa)', () => {
|
||||
const gpx = route('gpx/:gpx(/3trk/:trk)');
|
||||
expect(gpx('gpx/10')).toMatchObject({ gpx: '10' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checking gpx ids', () => {
|
||||
const id = {
|
||||
gpx: 1234567890123456,
|
||||
};
|
||||
const key = 'gpx/1234567890123456';
|
||||
test(', vice', () => {
|
||||
const gpx = uri('gpx', id);
|
||||
expect(gpx).toBe(key);
|
||||
});
|
||||
test(', and versa', () => {
|
||||
const gpx = uri('gpx', key);
|
||||
expect(gpx).toMatchObject(id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checking trk ids', () => {
|
||||
const id = {
|
||||
gpx: 1234567890123456,
|
||||
trk: 123456,
|
||||
};
|
||||
const key = 'gpx/1234567890123456/3trk/123456';
|
||||
test(', vice', () => {
|
||||
const rte = uri('trk', id);
|
||||
expect(rte).toBe(key);
|
||||
});
|
||||
test(', and versa', () => {
|
||||
const rte = uri('trk', key);
|
||||
expect(rte).toMatchObject(id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checking trkseg ids', () => {
|
||||
const id = {
|
||||
gpx: 111,
|
||||
trk: 0,
|
||||
trkseg: 3,
|
||||
};
|
||||
const key = 'gpx/0000000000000111/3trk/000000/000003';
|
||||
test(', vice', () => {
|
||||
const rte = uri('trkseg', id);
|
||||
expect(rte).toBe(key);
|
||||
});
|
||||
test(', and versa', () => {
|
||||
const rte = uri('trkseg', key);
|
||||
expect(rte).toMatchObject(id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checking trkpt ids', () => {
|
||||
const id = {
|
||||
gpx: 25,
|
||||
trk: 8,
|
||||
trkseg: 0,
|
||||
trkpt: 155,
|
||||
};
|
||||
const key = 'gpx/0000000000000025/3trk/000008/000000/000155';
|
||||
test(', vice', () => {
|
||||
const rte = uri('trkpt', id);
|
||||
expect(rte).toBe(key);
|
||||
});
|
||||
test(', and versa', () => {
|
||||
const rte = uri('trkpt', key);
|
||||
expect(rte).toMatchObject(id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checking settings id', () => {
|
||||
test(', vice', () => {
|
||||
const rte = uri('settings', {});
|
||||
expect(rte).toBe('settings');
|
||||
});
|
||||
test(', and versa', () => {
|
||||
const rte = uri('settings', 'settings');
|
||||
expect(rte).toMatchObject({});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user