Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema: support multiple positions at a single company #473

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@
"type": "string",
"description": "e.g. Social Media Company"
},
"positions": {
"type": "array",
"description": "Define multiple positions at the same company.",
"additionalItems": false,
"items": {
"type": "object",
"additionalProperties": true,
"properties": {
"title": {
"type": "string",
"description": "e.g. Software Engineer"
},
"startDate": {
"$ref": "#/definitions/iso8601"
},
"endDate": {
"$ref": "#/definitions/iso8601"
}
}
}
},
"position": {
"type": "string",
"description": "e.g. Software Engineer"
Expand Down
21 changes: 21 additions & 0 deletions test/__test__/work.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,27 @@
}
]
},
"positionsValid": {
"work": [
{
"positions": [
{
"title": "Cat Herder",
"startDate": "2014-02-12",
"endDate": "2014-02-13"
},
{}
]
}
]
},
"positionsInvalid": {
"work": [
{
"positions": null
}
]
},
"positionValid": {
"work": [
{
Expand Down
16 changes: 16 additions & 0 deletions test/work.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ test('work[].position - invalid', (t) => {
t.end();
});

test('work[].positions - valid', (t) => {
validate(fixtures.positionsValid, (err, valid) => {
t.equal(err, null, 'err should be null');
t.true(valid, 'valid is true');
});
t.end();
});

test('work[].positions - invalid', (t) => {
validate(fixtures.positionsInvalid, (err, valid) => {
t.notEqual(err, null, 'err should contain an error');
t.false(valid, 'valid is false');
});
t.end();
});

test('work[].url - valid', (t) => {
validate(fixtures.urlValid, (err, valid) => {
t.equal(err, null, 'err should be null');
Expand Down