github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/tests/acceptance/allocation-fs-test.js (about)

     1  /* eslint-disable ember-a11y-testing/a11y-audit-called */ // Covered in behaviours/fs
     2  import { module } from 'qunit';
     3  import { setupApplicationTest } from 'ember-qunit';
     4  
     5  import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
     6  
     7  import browseFilesystem from './behaviors/fs';
     8  
     9  let allocation;
    10  let files;
    11  
    12  module('Acceptance | allocation fs', function(hooks) {
    13    setupApplicationTest(hooks);
    14    setupMirage(hooks);
    15  
    16    hooks.beforeEach(async function() {
    17      server.create('agent');
    18      server.create('node', 'forceIPv4');
    19      const job = server.create('job', { createAllocations: false });
    20  
    21      allocation = server.create('allocation', { jobId: job.id, clientStatus: 'running' });
    22  
    23      this.allocation = allocation;
    24  
    25      // Reset files
    26      files = [];
    27  
    28      // Nested files
    29      files.push(server.create('allocFile', { isDir: true, name: 'directory' }));
    30      files.push(server.create('allocFile', { isDir: true, name: 'another', parent: files[0] }));
    31      files.push(
    32        server.create('allocFile', 'file', {
    33          name: 'something.txt',
    34          fileType: 'txt',
    35          parent: files[1],
    36        })
    37      );
    38  
    39      files.push(server.create('allocFile', { isDir: true, name: 'empty-directory' }));
    40      files.push(server.create('allocFile', 'file', { fileType: 'txt' }));
    41      files.push(server.create('allocFile', 'file', { fileType: 'txt' }));
    42  
    43      this.files = files;
    44      this.directory = files[0];
    45      this.nestedDirectory = files[1];
    46    });
    47  
    48    browseFilesystem({
    49      visitSegments: ({ allocation }) => ({ id: allocation.id }),
    50      getExpectedPathBase: ({ allocation }) => `/allocations/${allocation.id}/fs/`,
    51      getTitleComponent: ({ allocation }) => `Allocation ${allocation.id.split('-')[0]} filesystem`,
    52      getBreadcrumbComponent: ({ allocation }) => allocation.id.split('-')[0],
    53      getFilesystemRoot: () => '',
    54      pageObjectVisitFunctionName: 'visitAllocation',
    55      pageObjectVisitPathFunctionName: 'visitAllocationPath',
    56    });
    57  });