summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/clusters/components/applications_spec.js10
-rw-r--r--spec/javascripts/environments/environments_store_spec.js74
-rw-r--r--spec/javascripts/test_bundle.js72
3 files changed, 74 insertions, 82 deletions
diff --git a/spec/javascripts/clusters/components/applications_spec.js b/spec/javascripts/clusters/components/applications_spec.js
index 790e4b9602c..e2466bf326c 100644
--- a/spec/javascripts/clusters/components/applications_spec.js
+++ b/spec/javascripts/clusters/components/applications_spec.js
@@ -141,7 +141,7 @@ describe('Applications', () => {
});
describe('without ip address', () => {
- it('renders an input text with a loading icon and an alert text', () => {
+ it('renders an input text with a question mark and an alert text', () => {
vm = mountComponent(Applications, {
applications: {
...APPLICATIONS_MOCK_STATE,
@@ -152,7 +152,8 @@ describe('Applications', () => {
},
});
- expect(vm.$el.querySelector('.js-ingress-ip-loading-icon')).not.toBe(null);
+ expect(vm.$el.querySelector('.js-endpoint').value).toEqual('?');
+
expect(vm.$el.querySelector('.js-no-endpoint-message')).not.toBe(null);
});
});
@@ -329,7 +330,7 @@ describe('Applications', () => {
});
describe('without ip address', () => {
- it('renders an input text with a loading icon and an alert text', () => {
+ it('renders an input text with a question mark and an alert text', () => {
vm = mountComponent(Applications, {
applications: {
...APPLICATIONS_MOCK_STATE,
@@ -341,7 +342,8 @@ describe('Applications', () => {
},
});
- expect(vm.$el.querySelector('.js-knative-ip-loading-icon')).not.toBe(null);
+ expect(vm.$el.querySelector('.js-knative-endpoint').value).toEqual('?');
+
expect(vm.$el.querySelector('.js-no-knative-endpoint-message')).not.toBe(null);
});
});
diff --git a/spec/javascripts/environments/environments_store_spec.js b/spec/javascripts/environments/environments_store_spec.js
index 8abdbcbbe54..c3d16f10d72 100644
--- a/spec/javascripts/environments/environments_store_spec.js
+++ b/spec/javascripts/environments/environments_store_spec.js
@@ -34,46 +34,54 @@ describe('Store', () => {
expect(store.state.stoppedCounter).toEqual(2);
});
- it('should add folder keys when environment is a folder', () => {
- const environment = {
- name: 'bar',
- size: 3,
- id: 2,
- };
+ describe('store environments', () => {
+ it('should store environments', () => {
+ store.storeEnvironments(serverData);
- store.storeEnvironments([environment]);
+ expect(store.state.environments.length).toEqual(serverData.length);
+ });
- expect(store.state.environments[0].isFolder).toEqual(true);
- expect(store.state.environments[0].folderName).toEqual('bar');
- });
+ it('should add folder keys when environment is a folder', () => {
+ const environment = {
+ name: 'bar',
+ size: 3,
+ id: 2,
+ };
- it('should extract content of `latest` key when provided', () => {
- const environment = {
- name: 'bar',
- size: 3,
- id: 2,
- latest: {
- last_deployment: {},
- isStoppable: true,
- },
- };
-
- store.storeEnvironments([environment]);
-
- expect(store.state.environments[0].last_deployment).toEqual({});
- expect(store.state.environments[0].isStoppable).toEqual(true);
- });
+ store.storeEnvironments([environment]);
- it('should store latest.name when the environment is not a folder', () => {
- store.storeEnvironments(serverData);
+ expect(store.state.environments[0].isFolder).toEqual(true);
+ expect(store.state.environments[0].folderName).toEqual('bar');
+ });
- expect(store.state.environments[0].name).toEqual(serverData[0].latest.name);
- });
+ it('should extract content of `latest` key when provided', () => {
+ const environment = {
+ name: 'bar',
+ size: 3,
+ id: 2,
+ latest: {
+ last_deployment: {},
+ isStoppable: true,
+ },
+ };
- it('should store root level name when environment is a folder', () => {
- store.storeEnvironments(serverData);
+ store.storeEnvironments([environment]);
- expect(store.state.environments[1].folderName).toEqual(serverData[1].name);
+ expect(store.state.environments[0].last_deployment).toEqual({});
+ expect(store.state.environments[0].isStoppable).toEqual(true);
+ });
+
+ it('should store latest.name when the environment is not a folder', () => {
+ store.storeEnvironments(serverData);
+
+ expect(store.state.environments[0].name).toEqual(serverData[0].latest.name);
+ });
+
+ it('should store root level name when environment is a folder', () => {
+ store.storeEnvironments(serverData);
+
+ expect(store.state.environments[1].folderName).toEqual(serverData[1].name);
+ });
});
describe('toggleFolder', () => {
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index 235a17d13b0..5eef5682bbd 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -69,7 +69,7 @@ window.gl = window.gl || {};
window.gl.TEST_HOST = TEST_HOST;
window.gon = window.gon || {};
window.gon.test_env = true;
-window.gon.ee = process.env.EE;
+window.gon.ee = false;
gon.relative_url_root = '';
let hasUnhandledPromiseRejections = false;
@@ -122,26 +122,19 @@ afterEach(() => {
const axiosDefaultAdapter = getDefaultAdapter();
// render all of our tests
-const testContexts = [require.context('spec', true, /_spec$/)];
-
-if (process.env.EE) {
- testContexts.push(require.context('ee_spec', true, /_spec$/));
-}
-
-testContexts.forEach(context => {
- context.keys().forEach(path => {
- try {
- context(path);
- } catch (err) {
- console.log(err);
- console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path);
- describe('Test bundle', function() {
- it(`includes '${path}'`, function() {
- expect(err).toBeNull();
- });
+const testsContext = require.context('.', true, /_spec$/);
+testsContext.keys().forEach(function(path) {
+ try {
+ testsContext(path);
+ } catch (err) {
+ console.log(err);
+ console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path);
+ describe('Test bundle', function() {
+ it(`includes '${path}'`, function() {
+ expect(err).toBeNull();
});
- }
- });
+ });
+ }
});
describe('test errors', () => {
@@ -211,35 +204,24 @@ if (process.env.BABEL_ENV === 'coverage') {
];
describe('Uncovered files', function() {
- const sourceFilesContexts = [require.context('~', true, /\.(js|vue)$/)];
-
- if (process.env.EE) {
- sourceFilesContexts.push(require.context('ee', true, /\.(js|vue)$/));
- }
-
- const allTestFiles = testContexts.reduce(
- (accumulator, context) => accumulator.concat(context.keys()),
- [],
- );
+ const sourceFiles = require.context('~', true, /\.(js|vue)$/);
$.holdReady(true);
- sourceFilesContexts.forEach(context => {
- context.keys().forEach(path => {
- // ignore if there is a matching spec file
- if (allTestFiles.indexOf(`${path.replace(/\.(js|vue)$/, '')}_spec`) > -1) {
- return;
- }
-
- it(`includes '${path}'`, function() {
- try {
- context(path);
- } catch (err) {
- if (troubleMakers.indexOf(path) === -1) {
- expect(err).toBeNull();
- }
+ sourceFiles.keys().forEach(function(path) {
+ // ignore if there is a matching spec file
+ if (testsContext.keys().indexOf(`${path.replace(/\.(js|vue)$/, '')}_spec`) > -1) {
+ return;
+ }
+
+ it(`includes '${path}'`, function() {
+ try {
+ sourceFiles(path);
+ } catch (err) {
+ if (troubleMakers.indexOf(path) === -1) {
+ expect(err).toBeNull();
}
- });
+ }
});
});
});