Lines Matching refs:t

102 export async function test(t) {  argument
105 const describeWithPermissions = shouldSkipTestsRequiringPermissions ? t.xdescribe : t.describe;
110 : t.jasmine.DEFAULT_TIMEOUT_INTERVAL;
123 const oldIt = t.it;
124 t.it = (name, fn, timeout) =>
135 t.beforeAll(async () => {
143 t.describe('With default assets', async () => {
164 t.beforeAll(async () => {
185 t.afterAll(async () => {
189 t.describe('Every return value has proper shape', async () => {
190 t.it('createAssetAsync', () => {
192 ASSET_KEYS.forEach((key) => t.expect(keys).toContain(key));
195 t.it('getAssetInfoAsync', async () => {
199 INFO_KEYS.forEach((key) => t.expect(keys).toContain(key));
202 t.it('getAlbumAsync', async () => {
205 ALBUM_KEYS.forEach((key) => t.expect(keys).toContain(key));
208 t.it('getAssetsAsync', async () => {
211 GET_ASSETS_KEYS.forEach((key) => t.expect(keys).toContain(key));
215 t.describe('Small tests', async () => {
216 t.it('Function getAlbums returns test album', async () => {
218 t.expect(albums.filter((elem) => elem.id === album.id).length).toBe(1);
221 t.it('getAlbum returns test album', async () => {
223 t.expect(otherAlbum.title).toBe(album.title);
224 t.expect(otherAlbum.id).toBe(album.id);
225 t.expect(otherAlbum.assetCount).toBe(F_SIZE);
228 t.it('getAlbum with not existing album', async () => {
230 t.expect(album).toBeNull();
233 t.it('getAssetInfo with not existing id', async () => {
235 t.expect(asset).toBeNull();
238 t.it(
241 t.expect(
247 t.it(
250 t.expect(
266 t.describe('getAssetsAsync', async () => {
267 t.it('No arguments', async () => {
270 t.expect(assets.length).toBeLessThanOrEqual(DEFAULT_PAGE_SIZE);
271 t.expect(assets.length).toBeGreaterThanOrEqual(IMG_NUMBER);
272 assets.forEach((asset) => t.expect(DEFAULT_MEDIA_TYPES).toContain(asset.mediaType));
275 t.it('album', async () => {
278 t.expect(assets.length).toBe(IMG_NUMBER);
279 assets.forEach((asset) => t.expect(DEFAULT_MEDIA_TYPES).toContain(asset.mediaType));
281 assets.forEach((asset) => t.expect(asset.albumId).toBe(album.id));
284 t.it('first, after', async () => {
289 t.expect(assets.length).toBe(2);
290 t.expect(totalCount).toBe(IMG_NUMBER);
291 t.expect(hasNextPage).toBeTruthy();
292 assets.forEach((asset) => t.expect(DEFAULT_MEDIA_TYPES).toContain(asset.mediaType));
297 t.expect(assets.length).toBe(IMG_NUMBER - 2);
298 t.expect(totalCount).toBe(IMG_NUMBER);
299 t.expect(hasNextPage).toBeFalsy();
303 t.it('mediaType: video', async () => {
307 assets.forEach((asset) => t.expect(asset.mediaType).toBe(mediaType));
308 t.expect(assets.length).toBe(1);
311 t.it('mediaType: photo', async () => {
315 t.expect(assets.length).toBe(IMG_NUMBER);
316 assets.forEach((asset) => t.expect(asset.mediaType).toBe(mediaType));
319 t.it('check size - photo', async () => {
323 t.expect(assets.length).toBe(IMG_NUMBER);
325 t.expect(asset.width).not.toEqual(0);
326 t.expect(asset.height).not.toEqual(0);
330 t.it('check size - video', async () => {
334 t.expect(assets.length).toBe(VIDEO_NUMBER);
336 t.expect(asset.width).not.toEqual(0);
337 t.expect(asset.height).not.toEqual(0);
341 t.it('supports sorting in ascending order', async () => {
360 t.expect(ascFirst).toBe(last);
361 t.expect(ascLast).toBe(first);
364 t.it('supports getting assets from specified time range', async () => {
386 t.expect(filteredAssets.length).toBeLessThanOrEqual(assets.length);
390 t.expect(asset.creationTime).toBeLessThanOrEqual(createdBefore);
391 t.expect(asset.creationTime).toBeGreaterThanOrEqual(createdAfter);
396 t.describe('getAssetInfoAsync', async () => {
397 t.it('shouldDownloadFromNetwork: false, for photos', async () => {
410 expectedExtraKeys.forEach((key) => t.expect(keys).toContain(key));
412 t.expect(value['isNetworkAsset']).toBe(false);
416 t.it('shouldDownloadFromNetwork: true, for photos', async () => {
429 expectedExtraKeys.forEach((key) => t.expect(keys).not.toContain(key));
432 t.it('shouldDownloadFromNetwork: false, for videos', async () => {
445 expectedExtraKeys.forEach((key) => t.expect(keys).toContain(key));
447 t.expect(value['isNetworkAsset']).toBe(false);
451 t.it('shouldDownloadFromNetwork: true, for videos', async () => {
464 expectedExtraKeys.forEach((key) => t.expect(keys).not.toContain(key));
469 t.describe('Delete tests', async () => {
470 t.it(
478 t.expect(result).toEqual(true);
479 t.expect(assets.length).not.toEqual(0);
480 t.expect(deletedAssets.length).toEqual(assets.length);
481 deletedAssets.forEach((deletedAsset) => t.expect(deletedAsset).toBeNull);
486 t.it(
493 t.expect(result).toEqual(true);
495 t.expect(deletedAlbum).toBeNull();
504 t.it(
523 t.expect(firstAlbum).toBeNull();
524 t.expect(secondAlbum).toBeNull();
529 t.expect(firstAsset).toBeNull();
530 t.expect(secondAsset).toBeNull();
539 t.describe('Listeners', async () => {
542 t.afterAll(async () => {
548 t.it(
551 const spy = t.jasmine.createSpy('addAsset spy', () => {});
555 t.expect(asset).not.toBeNull();
556 await timeoutWrapper(() => t.expect(spy).toHaveBeenCalled(), WAIT_TIME);
564 t.it(
567 const spy = t.jasmine.createSpy('remove spy', () => {});
572 t.expect(asset).not.toBeNull();
573 await timeoutWrapper(() => t.expect(spy).not.toHaveBeenCalled(), WAIT_TIME);
580 t.it(
583 const spy = t.jasmine.createSpy('deleteAsset spy', () => {});
587 t.expect(asset).not.toBeNull();
589 await timeoutWrapper(() => t.expect(spy).toHaveBeenCalled(), WAIT_TIME);
595 t.it(
598 const spy = t.jasmine.createSpy('removeAll', () => {});
603 t.expect(asset).not.toBeNull();
604 await timeoutWrapper(() => t.expect(spy).not.toHaveBeenCalled(), WAIT_TIME);