Commit 6446b6aa authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'pb-fix-token-access-project-fetch' into 'master'

Fix project fetch bug on token access

See merge request gitlab-org/gitlab!65353
parents 3954ded4 42e7f3c0
......@@ -101,6 +101,10 @@ export default {
}
} catch (error) {
createFlash({ message: error });
} finally {
if (this.jobTokenScopeEnabled) {
this.getProjects();
}
}
},
async addProject() {
......
......@@ -108,7 +108,7 @@ describe('TokenAccess component', () => {
expect(findTokenSection().exists()).toBe(false);
});
it('switching the toggle calls the mutation', async () => {
it('switching the toggle calls the mutation and fetches the projects again', async () => {
createComponent([
[getCIJobTokenScopeQuery, disabledJobTokenScopeHandler],
[updateCIJobTokenScopeMutation, updateJobTokenScopeHandler],
......@@ -117,11 +117,16 @@ describe('TokenAccess component', () => {
await waitForPromises();
expect(getProjectsWithScope).toHaveBeenCalledTimes(1);
findToggle().vm.$emit('change', true);
await waitForPromises();
expect(updateJobTokenScopeHandler).toHaveBeenCalledWith({
input: { fullPath: projectPath, jobTokenScopeEnabled: true },
});
expect(getProjectsWithScope).toHaveBeenCalledTimes(2);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment