From 231536a7662bb6d444271314aa130711e8928a8a Mon Sep 17 00:00:00 2001 From: Matt Schuchard Date: Fri, 26 Apr 2024 10:28:08 -0400 Subject: [PATCH] update unit tests --- spec/fixtures/clean.yml | 6 +++--- spec/fixtures/include_has_issues.yml | 4 ++-- spec/linter-ansible-linting-spec.js | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/fixtures/clean.yml b/spec/fixtures/clean.yml index f95eb58..023a0fe 100644 --- a/spec/fixtures/clean.yml +++ b/spec/fixtures/clean.yml @@ -4,6 +4,6 @@ hosts: whatever tasks: - - name: Hello world - ansible.builtin.debug: - msg: 'Hello!' + - name: Hello world + ansible.builtin.debug: + msg: 'Hello!' diff --git a/spec/fixtures/include_has_issues.yml b/spec/fixtures/include_has_issues.yml index 3c415de..47d9887 100644 --- a/spec/fixtures/include_has_issues.yml +++ b/spec/fixtures/include_has_issues.yml @@ -3,5 +3,5 @@ - name: Include has issues hosts: whatever tasks: - - name: Include with issues - ansible.builtin.include_tasks: include_with_issues.yml + - name: Include with issues + ansible.builtin.include_tasks: include_with_issues.yml diff --git a/spec/linter-ansible-linting-spec.js b/spec/linter-ansible-linting-spec.js index 514b883..46ec87e 100644 --- a/spec/linter-ansible-linting-spec.js +++ b/spec/linter-ansible-linting-spec.js @@ -29,7 +29,7 @@ describe('The Ansible Lint provider for Linter', () => { it('finds all the messages', () => { waitsForPromise(() => lint(editor).then(messages => { - expect(messages.length).toEqual(12); + expect(messages.length).toEqual(29); }) ); }); @@ -155,7 +155,7 @@ describe('The Ansible Lint provider for Linter', () => { expect(messages[0].location.file).toBeDefined(); expect(messages[0].location.file).toMatch(/.+syntax\.yml$/); expect(messages[0].location.position).toBeDefined(); - expect(messages[0].location.position).toEqual([[5, 6], [5, 7]]); + expect(messages[0].location.position).toEqual([[5, 4], [5, 5]]); }); }); }); @@ -186,7 +186,7 @@ describe('The Ansible Lint provider for Linter', () => { expect(messages[0].severity).toBeDefined(); expect(messages[0].severity).toEqual('error'); expect(messages[0].excerpt).toBeDefined(); - expect(messages[0].excerpt).toEqual('Ansible syntax check failed for unknown reason; use syntax checker for more information.'); + expect(messages[0].excerpt).toEqual('load-failure[runtimeerror]: Failed to load YAML file: yaml_syntax.yml'); expect(messages[0].location.file).toBeDefined(); expect(messages[0].location.file).toMatch(/.+yaml_syntax\.yml$/); expect(messages[0].location.position).toBeDefined(); @@ -221,7 +221,7 @@ describe('The Ansible Lint provider for Linter', () => { expect(messages[0].severity).toBeDefined(); expect(messages[0].severity).toEqual('warning'); expect(messages[0].excerpt).toBeDefined(); - expect(messages[0].excerpt).toEqual("foo:1: load-failure [Errno 2] No such file or directory: 'foo' (filenotfounderror)"); + expect(messages[0].excerpt).toMatch(/foo:1: load-failure\[filenotfounderror\]: \[Errno 2\] No such file or directory: '.+spec\/fixtures\/foo'/); expect(messages[0].location.file).toBeDefined(); expect(messages[0].location.file).toMatch(/.+missing_include\.yml$/); expect(messages[0].location.position).toBeDefined(); @@ -329,7 +329,7 @@ describe('The Ansible Lint provider for Linter', () => { expect(messages[0].severity).toBeDefined(); expect(messages[0].severity).toEqual('warning'); expect(messages[0].excerpt).toBeDefined(); - expect(messages[0].excerpt).toEqual('yaml: too many blank lines (7 > 2) (empty-lines)'); + expect(messages[0].excerpt).toEqual('yaml[empty-lines]: Too many blank lines (7 > 2)'); expect(messages[1].location.file).toBeDefined(); expect(messages[1].location.file).toMatch(/.+include_with_issues\.yml$/); expect(messages[1].location.position).toBeDefined(); @@ -337,7 +337,7 @@ describe('The Ansible Lint provider for Linter', () => { expect(messages[1].severity).toBeDefined(); expect(messages[1].severity).toEqual('warning'); expect(messages[1].excerpt).toBeDefined(); - expect(messages[1].excerpt).toEqual('fqcn-builtins: Use FQCN for builtin actions.'); + expect(messages[1].excerpt).toEqual('fqcn[action-core]: Use FQCN for builtin module actions (command).'); expect(messages[2].location.file).toBeDefined(); expect(messages[2].location.file).toMatch(/.+include_with_issues\.yml$/); expect(messages[2].location.position).toBeDefined(); @@ -345,7 +345,7 @@ describe('The Ansible Lint provider for Linter', () => { expect(messages[2].severity).toBeDefined(); expect(messages[2].severity).toEqual('warning'); expect(messages[2].excerpt).toBeDefined(); - expect(messages[2].excerpt).toEqual('inline-env-var: Command module does not accept setting environment variables inline'); + expect(messages[2].excerpt).toEqual('inline-env-var: Command module does not accept setting environment variables inline.'); }); }); }); @@ -387,11 +387,11 @@ describe('The Ansible Lint provider for Linter', () => { expect(messages[0].location.file).toBeDefined(); expect(messages[0].location.file).toMatch(/.+include_with_issues\.yml$/); expect(messages[0].location.position).toBeDefined(); - expect(messages[0].location.position).toEqual([[9, 2], [9, 3]]); + expect(messages[0].location.position).toEqual([[8, 0], [8, 1]]); expect(messages[0].severity).toBeDefined(); - expect(messages[0].severity).toEqual('error'); + expect(messages[0].severity).toEqual('warning'); expect(messages[0].excerpt).toBeDefined(); - expect(messages[0].excerpt).toEqual("syntax-check: 'command' is not a valid attribute for a Play"); + expect(messages[0].excerpt).toEqual('yaml[empty-lines]: Too many blank lines (7 > 2)'); }); }); });